mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-01 11:13:38 +00:00
* Add .scalafmt.conf
* Adopt quill for database access
* Removed postgresql-async
* Refactored all instances of database access
* Creating duplicate characters of the same account is no longer possible
* Rewrote large parts of LoginSessionActor
* Implement migrations
* Move overrides into subdirectory
* Make usernames case insensitive
* Use LOWER(?) comparison instead of storing lowercased username
* import scala.util.{Success, Failure}
* Add config and joda-time dependencies
* Add sbt-scalafmt
* Use defaultWithAlign scalafmt preset
* Format all
* Add scalafix
* Remove unused imports
* Don't lowercase username when inserting
* Update readme
* Listen on worldserver.Hostname address
* Remove database test on startup
It could fail when the global thread pool is busy loading zone
maps. Migrations run on the main thread and also serve the
purpose of verifying the database configuration so it's fine to
remove the test altogether.
* Refactor chat message handlers, zones
What started as a small change to how zones are stored turned
into a pretty big effort of refactoring the chat message handler.
The !hack command was removed, the /capturebase commandwas added.
* Expose db ports in docker-compose.yml
* Silence property override log
* Rework configuration
* Unify configuration using the typesafe.config library
* Add configuration option for public address
* Configuration is now loaded from application.conf rather than worldserver.ini
* Refactor PsLogin and remove unnecessary logging
* Move pslogin into net.psforever.pslogin namespace
* Fix coverage
This commit is contained in:
parent
88b194fde2
commit
e0defe8240
850 changed files with 144487 additions and 47476 deletions
|
|
@ -61,8 +61,8 @@ class CodecTest extends Specification {
|
|||
|
||||
"Angular" should {
|
||||
"roll" should {
|
||||
val string_roll_0 = hex"00"
|
||||
val string_roll_90 = hex"20"
|
||||
val string_roll_0 = hex"00"
|
||||
val string_roll_90 = hex"20"
|
||||
val string_roll_180 = hex"40"
|
||||
val string_roll_270 = hex"60"
|
||||
|
||||
|
|
@ -100,8 +100,8 @@ class CodecTest extends Specification {
|
|||
}
|
||||
|
||||
"pitch" should {
|
||||
val string_pitch_0 = hex"00"
|
||||
val string_pitch_90 = hex"60"
|
||||
val string_pitch_0 = hex"00"
|
||||
val string_pitch_90 = hex"60"
|
||||
val string_pitch_180 = hex"40"
|
||||
val string_pitch_270 = hex"20"
|
||||
|
||||
|
|
@ -139,14 +139,14 @@ class CodecTest extends Specification {
|
|||
}
|
||||
|
||||
"yaw, normal" should {
|
||||
val string_pitch_0 = hex"00"
|
||||
val string_pitch_90 = hex"60"
|
||||
val string_pitch_0 = hex"00"
|
||||
val string_pitch_90 = hex"60"
|
||||
val string_pitch_180 = hex"40"
|
||||
val string_pitch_270 = hex"20"
|
||||
val string_yaw_0 = hex"20"
|
||||
val string_yaw_90 = hex"00"
|
||||
val string_yaw_180 = hex"60"
|
||||
val string_yaw_270 = hex"40"
|
||||
val string_yaw_0 = hex"20"
|
||||
val string_yaw_90 = hex"00"
|
||||
val string_yaw_180 = hex"60"
|
||||
val string_yaw_270 = hex"40"
|
||||
|
||||
"decode (0)" in {
|
||||
Angular.codec_yaw(0f).decode(string_yaw_0.bits).require.value mustEqual 270f
|
||||
|
|
@ -182,8 +182,8 @@ class CodecTest extends Specification {
|
|||
}
|
||||
|
||||
"yaw, North-corrected" should {
|
||||
val string_yaw_0 = hex"20"
|
||||
val string_yaw_90 = hex"00"
|
||||
val string_yaw_0 = hex"20"
|
||||
val string_yaw_90 = hex"00"
|
||||
val string_yaw_180 = hex"60"
|
||||
val string_yaw_270 = hex"40"
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ class CosmeticsTest extends Specification {
|
|||
Cosmetics().pstyles mustEqual 0
|
||||
Cosmetics(3).pstyles mustEqual 3
|
||||
Cosmetics(PersonalStyle.NoHelmet).pstyles mustEqual PersonalStyle.NoHelmet.id
|
||||
Cosmetics(Set(PersonalStyle.NoHelmet, PersonalStyle.Earpiece)).pstyles mustEqual PersonalStyle.NoHelmet.id + PersonalStyle.Earpiece.id
|
||||
Cosmetics(
|
||||
Set(PersonalStyle.NoHelmet, PersonalStyle.Earpiece)
|
||||
).pstyles mustEqual PersonalStyle.NoHelmet.id + PersonalStyle.Earpiece.id
|
||||
Cosmetics(true, false, false, false, false).pstyles mustEqual PersonalStyle.NoHelmet.id
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ import net.psforever.crypto.CryptoInterface
|
|||
import net.psforever.crypto.CryptoInterface.CryptoDHState
|
||||
import scodec.bits._
|
||||
|
||||
class CryptoInterfaceTest extends Specification { args(stopOnFail = true)
|
||||
class CryptoInterfaceTest extends Specification {
|
||||
args(stopOnFail = true)
|
||||
"Crypto interface" should {
|
||||
"correctly initialize" in {
|
||||
CryptoInterface.initialize()
|
||||
|
|
@ -13,13 +14,13 @@ class CryptoInterfaceTest extends Specification { args(stopOnFail = true)
|
|||
}
|
||||
|
||||
"encrypt and decrypt" in {
|
||||
val key = hex"41414141"
|
||||
val key = hex"41414141"
|
||||
val plaintext = ByteVector.fill(16)(0x42)
|
||||
|
||||
val crypto = new CryptoInterface.CryptoState(key, key)
|
||||
|
||||
val ciphertext = crypto.encrypt(plaintext)
|
||||
val decrypted = crypto.decrypt(ciphertext)
|
||||
val decrypted = crypto.decrypt(ciphertext)
|
||||
|
||||
crypto.close
|
||||
decrypted mustEqual plaintext
|
||||
|
|
@ -27,13 +28,13 @@ class CryptoInterfaceTest extends Specification { args(stopOnFail = true)
|
|||
}
|
||||
|
||||
"encrypt and decrypt must handle no bytes" in {
|
||||
val key = hex"41414141"
|
||||
val key = hex"41414141"
|
||||
val empty = ByteVector.empty
|
||||
|
||||
val crypto = new CryptoInterface.CryptoState(key, key)
|
||||
|
||||
val ciphertext = crypto.encrypt(empty)
|
||||
val decrypted = crypto.decrypt(ciphertext)
|
||||
val decrypted = crypto.decrypt(ciphertext)
|
||||
|
||||
crypto.close
|
||||
|
||||
|
|
@ -42,8 +43,8 @@ class CryptoInterfaceTest extends Specification { args(stopOnFail = true)
|
|||
}
|
||||
|
||||
"encrypt and decrypt must only accept block aligned inputs" in {
|
||||
val key = hex"41414141"
|
||||
val badPad = ByteVector.fill(CryptoInterface.RC5_BLOCK_SIZE-1)('a')
|
||||
val key = hex"41414141"
|
||||
val badPad = ByteVector.fill(CryptoInterface.RC5_BLOCK_SIZE - 1)('a')
|
||||
|
||||
val crypto = new CryptoInterface.CryptoState(key, key)
|
||||
|
||||
|
|
@ -109,7 +110,7 @@ class CryptoInterfaceTest extends Specification { args(stopOnFail = true)
|
|||
|
||||
"safely handle multiple starts" in {
|
||||
val dontCare = ByteVector.fill(16)(0x42)
|
||||
val dh = new CryptoDHState()
|
||||
val dh = new CryptoDHState()
|
||||
|
||||
dh.start()
|
||||
dh.start() must throwA[IllegalStateException]
|
||||
|
|
@ -120,7 +121,7 @@ class CryptoInterfaceTest extends Specification { args(stopOnFail = true)
|
|||
|
||||
"prevent function calls before initialization" in {
|
||||
val dontCare = ByteVector.fill(16)(0x42)
|
||||
val dh = new CryptoDHState()
|
||||
val dh = new CryptoDHState()
|
||||
|
||||
dh.getGenerator must throwA[IllegalStateException]
|
||||
dh.getModulus must throwA[IllegalStateException]
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class CryptoPacketTest extends Specification {
|
|||
val string = hex"00261e2751bdc1ce000000000001d300000002".bits
|
||||
|
||||
"decode" in {
|
||||
val res = Codec.decode[ServerStart](string)
|
||||
val res = Codec.decode[ServerStart](string)
|
||||
val value = res.require.value
|
||||
|
||||
value.clientNonce mustEqual cNonce
|
||||
|
|
@ -47,16 +47,16 @@ class CryptoPacketTest extends Specification {
|
|||
}
|
||||
|
||||
"ClientChallengeXchg" should {
|
||||
val time = hex"962d8453"
|
||||
val time = hex"962d8453"
|
||||
val timeDecoded = scodec.codecs.uint32L.decode(time.bits).require.value
|
||||
val challenge = hex"24f5997c c7d16031 d1f567e9"
|
||||
val p = hex"f57511eb 8e5d1efb 8b7f3287 d5a18b17"
|
||||
val g = hex"00000000 00000000 00000000 00000002"
|
||||
val challenge = hex"24f5997c c7d16031 d1f567e9"
|
||||
val p = hex"f57511eb 8e5d1efb 8b7f3287 d5a18b17"
|
||||
val g = hex"00000000 00000000 00000000 00000002"
|
||||
val string = (hex"0101" ++ time ++ challenge ++ hex"00 01 0002 ff 2400 00 1000" ++
|
||||
p ++ hex"1000" ++ g ++ hex"0000010307000000").bits
|
||||
|
||||
"decode" in {
|
||||
val res = Codec.decode[ClientChallengeXchg](string)
|
||||
val res = Codec.decode[ClientChallengeXchg](string)
|
||||
val value = res.require.value
|
||||
|
||||
value.time mustEqual timeDecoded
|
||||
|
|
@ -73,14 +73,14 @@ class CryptoPacketTest extends Specification {
|
|||
}
|
||||
|
||||
"ServerChallengeXchg" should {
|
||||
val time = hex"962d8453"
|
||||
val time = hex"962d8453"
|
||||
val timeDecoded = scodec.codecs.uint32L.decode(time.bits).require.value
|
||||
val challenge = hex"1b0e6408 cd935ec2 429aeb58"
|
||||
val pubKey = hex"51f83ce6 45e86c3e 79c8fc70 f6ddf14b"
|
||||
val string = (hex"0201" ++ time ++ challenge ++ hex"00 01 03070000000c00 1000 " ++ pubKey ++ hex"0e").bits
|
||||
val challenge = hex"1b0e6408 cd935ec2 429aeb58"
|
||||
val pubKey = hex"51f83ce6 45e86c3e 79c8fc70 f6ddf14b"
|
||||
val string = (hex"0201" ++ time ++ challenge ++ hex"00 01 03070000000c00 1000 " ++ pubKey ++ hex"0e").bits
|
||||
|
||||
"decode" in {
|
||||
val res = Codec.decode[ServerChallengeXchg](string)
|
||||
val res = Codec.decode[ServerChallengeXchg](string)
|
||||
val value = res.require.value
|
||||
|
||||
value.time mustEqual timeDecoded
|
||||
|
|
@ -97,11 +97,11 @@ class CryptoPacketTest extends Specification {
|
|||
|
||||
"ClientFinished" should {
|
||||
val challengeResult = hex"ea3cf05d a5cb4256 8bb91aa7"
|
||||
val pubKey = hex"eddc35f2 52b02d0e 496ba273 54578e73"
|
||||
val string = (hex"10 1000" ++ pubKey ++ hex"0114 " ++ challengeResult).bits
|
||||
val pubKey = hex"eddc35f2 52b02d0e 496ba273 54578e73"
|
||||
val string = (hex"10 1000" ++ pubKey ++ hex"0114 " ++ challengeResult).bits
|
||||
|
||||
"decode" in {
|
||||
val res = Codec.decode[ClientFinished](string)
|
||||
val res = Codec.decode[ClientFinished](string)
|
||||
val value = res.require.value
|
||||
|
||||
value.challengeResult mustEqual challengeResult
|
||||
|
|
@ -117,10 +117,10 @@ class CryptoPacketTest extends Specification {
|
|||
|
||||
"ServerFinished" should {
|
||||
val challengeResult = hex"d64ffb8e 526311b4 af46bece"
|
||||
val string = (hex"0114" ++ challengeResult).bits
|
||||
val string = (hex"0114" ++ challengeResult).bits
|
||||
|
||||
"decode" in {
|
||||
val res = Codec.decode[ServerFinished](string)
|
||||
val res = Codec.decode[ServerFinished](string)
|
||||
val value = res.require.value
|
||||
|
||||
value.challengeResult mustEqual challengeResult
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class PacketCodingTest extends Specification {
|
|||
val serverNonce = 848483
|
||||
|
||||
val packetUnderTest = ServerStart(clientNonce, serverNonce)
|
||||
val pkt = PacketCoding.MarshalPacket(ControlPacket(packetUnderTest.opcode, packetUnderTest)).require
|
||||
val pkt = PacketCoding.MarshalPacket(ControlPacket(packetUnderTest.opcode, packetUnderTest)).require
|
||||
|
||||
val decoded = PacketCoding.UnmarshalPacket(pkt.toByteVector).require.asInstanceOf[ControlPacket]
|
||||
val recvPkt = decoded.packet.asInstanceOf[ServerStart]
|
||||
|
|
|
|||
|
|
@ -78,14 +78,14 @@ class Vector3Test extends Specification {
|
|||
}
|
||||
|
||||
"calculate the unit vector (zero)" in {
|
||||
Vector3.Unit(Vector3.Zero) mustEqual Vector3(0,0,0)
|
||||
Vector3.Unit(Vector3.Zero) mustEqual Vector3(0, 0, 0)
|
||||
}
|
||||
|
||||
"calculate the unit vector (normal)" in {
|
||||
import Vector3._
|
||||
val one_root_two : Float = (1/math.sqrt(2)).toFloat
|
||||
val one_root_three : Float = (1/math.sqrt(3)).toFloat
|
||||
val ulp : Float = math.ulp(1) //measure of insignificance
|
||||
val one_root_two: Float = (1 / math.sqrt(2)).toFloat
|
||||
val one_root_three: Float = (1 / math.sqrt(3)).toFloat
|
||||
val ulp: Float = math.ulp(1) //measure of insignificance
|
||||
|
||||
Unit(Vector3(1, 0, 0)) mustEqual Vector3(1, 0, 0)
|
||||
1 - Magnitude(Vector3(1, 0, 0)) < ulp mustEqual true
|
||||
|
|
@ -110,9 +110,9 @@ class Vector3Test extends Specification {
|
|||
}
|
||||
|
||||
"calculate the cross product (identity)" in {
|
||||
val Vx : Vector3 = Vector3(1, 0, 0)
|
||||
val Vy : Vector3 = Vector3(0, 1, 0)
|
||||
val Vz : Vector3 = Vector3(0, 0, 1)
|
||||
val Vx: Vector3 = Vector3(1, 0, 0)
|
||||
val Vy: Vector3 = Vector3(0, 1, 0)
|
||||
val Vz: Vector3 = Vector3(0, 0, 1)
|
||||
|
||||
Vector3.CrossProduct(Vx, Vy) mustEqual Vz
|
||||
Vector3.CrossProduct(Vy, Vz) mustEqual Vx
|
||||
|
|
@ -124,86 +124,86 @@ class Vector3Test extends Specification {
|
|||
}
|
||||
|
||||
"calculate the cross product (full)" in {
|
||||
val A : Vector3 = Vector3(2, 1, -1)
|
||||
val B : Vector3 = Vector3(-3, 4, 1)
|
||||
val A: Vector3 = Vector3(2, 1, -1)
|
||||
val B: Vector3 = Vector3(-3, 4, 1)
|
||||
|
||||
Vector3.CrossProduct(A, B) mustEqual Vector3(5, 1, 11)
|
||||
Vector3.CrossProduct(B, A) mustEqual Vector3(-5, -1, -11)
|
||||
}
|
||||
|
||||
"find a perpendicular vector with cross product" in {
|
||||
val A : Vector3 = Vector3(2, 1, -1)
|
||||
val B : Vector3 = Vector3(-3, 4, 1)
|
||||
val C : Vector3 = Vector3.CrossProduct(A, B)
|
||||
val A: Vector3 = Vector3(2, 1, -1)
|
||||
val B: Vector3 = Vector3(-3, 4, 1)
|
||||
val C: Vector3 = Vector3.CrossProduct(A, B)
|
||||
|
||||
Vector3.DotProduct(A, C) mustEqual 0
|
||||
Vector3.DotProduct(B, C) mustEqual 0
|
||||
}
|
||||
|
||||
"calculate the scalar projection (perpendicular vectors)" in {
|
||||
val Vx : Vector3 = Vector3(1, 0, 0)
|
||||
val Vy : Vector3 = Vector3(0, 1, 0)
|
||||
val Vx: Vector3 = Vector3(1, 0, 0)
|
||||
val Vy: Vector3 = Vector3(0, 1, 0)
|
||||
|
||||
Vector3.ScalarProjection(Vx, Vy) mustEqual 0
|
||||
}
|
||||
|
||||
"calculate the scalar projection (parallel vectors)" in {
|
||||
val A : Vector3 = Vector3(2, 0, 0)
|
||||
val B : Vector3 = Vector3(10, 0, 0)
|
||||
val A: Vector3 = Vector3(2, 0, 0)
|
||||
val B: Vector3 = Vector3(10, 0, 0)
|
||||
|
||||
Vector3.ScalarProjection(A, B) mustEqual 2
|
||||
Vector3.ScalarProjection(B, A) mustEqual 10
|
||||
}
|
||||
|
||||
"calculate the scalar projection (antiparallel vectors)" in {
|
||||
val A : Vector3 = Vector3(2, 0, 0)
|
||||
val B : Vector3 = Vector3(-10, 0, 0)
|
||||
val A: Vector3 = Vector3(2, 0, 0)
|
||||
val B: Vector3 = Vector3(-10, 0, 0)
|
||||
|
||||
Vector3.ScalarProjection(A, B) mustEqual -2
|
||||
Vector3.ScalarProjection(B, A) mustEqual -10
|
||||
}
|
||||
|
||||
"calculate the scalar projection (normal)" in {
|
||||
val A : Vector3 = Vector3(2, 1, -1)
|
||||
val B : Vector3 = Vector3(3, 4, 1)
|
||||
val A: Vector3 = Vector3(2, 1, -1)
|
||||
val B: Vector3 = Vector3(3, 4, 1)
|
||||
|
||||
Vector3.ScalarProjection(A, B) mustEqual 1.7650452f
|
||||
Vector3.ScalarProjection(B, A) mustEqual 3.6742344f
|
||||
}
|
||||
|
||||
"calculate the vector projection (perpendicular vectors)" in {
|
||||
val Vx : Vector3 = Vector3(1, 0, 0)
|
||||
val Vy : Vector3 = Vector3(0, 1, 0)
|
||||
val Vx: Vector3 = Vector3(1, 0, 0)
|
||||
val Vy: Vector3 = Vector3(0, 1, 0)
|
||||
|
||||
Vector3.VectorProjection(Vx, Vy) mustEqual Vector3.Zero
|
||||
}
|
||||
|
||||
"calculate the vector projection (parallel vectors)" in {
|
||||
val A : Vector3 = Vector3(2, 0, 0)
|
||||
val B : Vector3 = Vector3(10, 0, 0)
|
||||
val A: Vector3 = Vector3(2, 0, 0)
|
||||
val B: Vector3 = Vector3(10, 0, 0)
|
||||
|
||||
Vector3.VectorProjection(A, B) mustEqual A
|
||||
Vector3.VectorProjection(B, A) mustEqual B
|
||||
}
|
||||
|
||||
"calculate the vector projection (antiparallel vectors)" in {
|
||||
val A : Vector3 = Vector3(2, 0, 0)
|
||||
val B : Vector3 = Vector3(-10, 0, 0)
|
||||
val A: Vector3 = Vector3(2, 0, 0)
|
||||
val B: Vector3 = Vector3(-10, 0, 0)
|
||||
|
||||
Vector3.VectorProjection(A, B) mustEqual A
|
||||
Vector3.VectorProjection(B, A) mustEqual B
|
||||
}
|
||||
|
||||
"calculate the vector projection (normal)" in {
|
||||
val A : Vector3 = Vector3(2, 1, -1)
|
||||
val B : Vector3 = Vector3(3, 4, 1)
|
||||
val A: Vector3 = Vector3(2, 1, -1)
|
||||
val B: Vector3 = Vector3(3, 4, 1)
|
||||
|
||||
Vector3.VectorProjection(A, B) mustEqual Vector3(1.0384614f, 1.3846153f, 0.34615383f)
|
||||
Vector3.VectorProjection(B, A) mustEqual Vector3(2.9999998f, 1.4999999f, -1.4999999f)
|
||||
}
|
||||
|
||||
"rotate positive x-axis-vector 90-degrees around the z-axis" in {
|
||||
val A : Vector3 = Vector3(1, 0, 0)
|
||||
val A: Vector3 = Vector3(1, 0, 0)
|
||||
A.Rz(0) mustEqual A
|
||||
A.Rz(90) mustEqual Vector3(0, 1, 0)
|
||||
A.Rz(180) mustEqual Vector3(-1, 0, 0)
|
||||
|
|
@ -212,7 +212,7 @@ class Vector3Test extends Specification {
|
|||
}
|
||||
|
||||
"rotate positive y-axis-vector 90-degrees around the x-axis" in {
|
||||
val A : Vector3 = Vector3(0, 1, 0)
|
||||
val A: Vector3 = Vector3(0, 1, 0)
|
||||
A.Rx(0) mustEqual A
|
||||
A.Rx(90) mustEqual Vector3(0, 0, 1)
|
||||
A.Rx(180) mustEqual Vector3(0, -1, 0)
|
||||
|
|
@ -221,7 +221,7 @@ class Vector3Test extends Specification {
|
|||
}
|
||||
|
||||
"rotate positive x-axis-vector 90-degrees around the y-axis" in {
|
||||
val A : Vector3 = Vector3(1, 0, 0)
|
||||
val A: Vector3 = Vector3(1, 0, 0)
|
||||
A.Ry(0) mustEqual A
|
||||
A.Ry(90) mustEqual Vector3(0, 0, -1)
|
||||
A.Ry(180) mustEqual Vector3(-1, 0, 0)
|
||||
|
|
@ -230,14 +230,14 @@ class Vector3Test extends Specification {
|
|||
}
|
||||
|
||||
"compound rotation" in {
|
||||
val A : Vector3 = Vector3(1, 0, 0)
|
||||
val A: Vector3 = Vector3(1, 0, 0)
|
||||
A.Rz(90)
|
||||
.Rx(90)
|
||||
.Ry(90) mustEqual A
|
||||
}
|
||||
|
||||
"45-degree rotation" in {
|
||||
val A : Vector3 = Vector3(1, 0, 0)
|
||||
val A: Vector3 = Vector3(1, 0, 0)
|
||||
A.Rz(45) mustEqual Vector3(0.70710677f, 0.70710677f, 0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,14 @@ import org.specs2.specification.Scope
|
|||
import scala.collection.mutable
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
abstract class ActorTest(sys : ActorSystem = ActorSystem("system", ConfigFactory.parseMap(ActorTest.LoggingConfig)))
|
||||
extends TestKit(sys) with Scope with ImplicitSender with AnyWordSpecLike with Matchers with BeforeAndAfterAll {
|
||||
override def afterAll : Unit = {
|
||||
abstract class ActorTest(sys: ActorSystem = ActorSystem("system", ConfigFactory.parseMap(ActorTest.LoggingConfig)))
|
||||
extends TestKit(sys)
|
||||
with Scope
|
||||
with ImplicitSender
|
||||
with AnyWordSpecLike
|
||||
with Matchers
|
||||
with BeforeAndAfterAll {
|
||||
override def afterAll: Unit = {
|
||||
TestKit.shutdownActorSystem(system)
|
||||
}
|
||||
}
|
||||
|
|
@ -22,9 +27,9 @@ abstract class ActorTest(sys : ActorSystem = ActorSystem("system", ConfigFactory
|
|||
object ActorTest {
|
||||
import scala.jdk.CollectionConverters._
|
||||
private val LoggingConfig = Map(
|
||||
"akka.loggers" -> List("akka.testkit.TestEventListener").asJava,
|
||||
"akka.loglevel" -> "OFF",
|
||||
"akka.stdout-loglevel" -> "OFF",
|
||||
"akka.loggers" -> List("akka.testkit.TestEventListener").asJava,
|
||||
"akka.loglevel" -> "OFF",
|
||||
"akka.stdout-loglevel" -> "OFF",
|
||||
"akka.log-dead-letters" -> "OFF"
|
||||
).asJava
|
||||
|
||||
|
|
@ -39,7 +44,7 @@ object ActorTest {
|
|||
* @param sys what to poll
|
||||
* @return a list of messages
|
||||
*/
|
||||
def receiveMultiple(n : Int, timeout : FiniteDuration, sys : TestKit) : List[Any] = {
|
||||
def receiveMultiple(n: Int, timeout: FiniteDuration, sys: TestKit): List[Any] = {
|
||||
assert(0 < n, s"number of expected messages must be positive non-zero integer - $n")
|
||||
val out = {
|
||||
val msgs = mutable.ListBuffer[Any]()
|
||||
|
|
@ -61,17 +66,16 @@ object ActorTest {
|
|||
* @param sendTo where to send mesages that have originated from an `actorProps` object;
|
||||
* typically should point back to the test environment constructed by `TestKit`
|
||||
*/
|
||||
class SupportActorInterface(actorProps : Props, sendTo : ActorRef) extends Actor {
|
||||
class SupportActorInterface(actorProps: Props, sendTo: ActorRef) extends Actor {
|
||||
val test = context.actorOf(actorProps, "support-actor")
|
||||
|
||||
def receive : Receive = {
|
||||
def receive: Receive = {
|
||||
case msg =>
|
||||
(if(sender == test) {
|
||||
sendTo
|
||||
}
|
||||
else {
|
||||
test
|
||||
}) ! msg
|
||||
(if (sender == test) {
|
||||
sendTo
|
||||
} else {
|
||||
test
|
||||
}) ! msg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,20 +21,20 @@ abstract class FreedContextActorTest extends ActorTest {
|
|||
various bizarre mechanisms have to be developed to use any methods that would pass in a context object.
|
||||
We create a middleman Actor whose main purpose is to surrender its context object to the test environment directly
|
||||
and then direct all messages sent to that object to the test environment.
|
||||
*/
|
||||
private val _testContextHandler = system.actorOf(Props(classOf[ContextSensitive]), "actor-test-cs")
|
||||
private implicit val timeout = Timeout(5 seconds)
|
||||
*/
|
||||
private val _testContextHandler = system.actorOf(Props(classOf[ContextSensitive]), "actor-test-cs")
|
||||
private implicit val timeout = Timeout(5 seconds)
|
||||
private val _testContextHandlerResult = ask(_testContextHandler, message = "", self)
|
||||
implicit val context = Await.result(_testContextHandlerResult, timeout.duration).asInstanceOf[ActorContext]
|
||||
implicit val context = Await.result(_testContextHandlerResult, timeout.duration).asInstanceOf[ActorContext]
|
||||
}
|
||||
|
||||
/**
|
||||
* Surrender your `context` object for a greater good!
|
||||
*/
|
||||
private class ContextSensitive extends Actor {
|
||||
var output : ActorRef = ActorRef.noSender
|
||||
var output: ActorRef = ActorRef.noSender
|
||||
|
||||
def receive : Receive = {
|
||||
def receive: Receive = {
|
||||
case _ =>
|
||||
context.become(PassThroughBehavior)
|
||||
output = sender
|
||||
|
|
@ -48,7 +48,7 @@ private class ContextSensitive extends Actor {
|
|||
* will now refer to whatever was the contact to gain access to it - the test environment.
|
||||
* @return something to `become`
|
||||
*/
|
||||
def PassThroughBehavior : Receive = {
|
||||
def PassThroughBehavior: Receive = {
|
||||
case msg => output forward msg
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ControlSyncRespTest extends Specification {
|
|||
case ControlSyncResp(a, b, c, d, e, f) =>
|
||||
a mustEqual 21096
|
||||
|
||||
b mustEqual 0x21392D92
|
||||
b mustEqual 0x21392d92
|
||||
c mustEqual 0x276
|
||||
d mustEqual 0x275
|
||||
e mustEqual 0x275
|
||||
|
|
@ -25,7 +25,7 @@ class ControlSyncRespTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val encoded = PacketCoding.EncodePacket(ControlSyncResp(21096, 0x21392D92, 0x276, 0x275, 0x275, 0x276)).require
|
||||
val encoded = PacketCoding.EncodePacket(ControlSyncResp(21096, 0x21392d92, 0x276, 0x275, 0x275, 0x276)).require
|
||||
|
||||
encoded.toByteVector mustEqual string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import scodec.bits._
|
|||
|
||||
class HandleGamePacketTest extends Specification {
|
||||
//this is the first from a series of SlottedMetaPacket4s; the length field was modified from 12 DC to pass the test
|
||||
val base = hex"18 D5 96 00 00 BC 8E 00 03 A2 16 5D A4 5F B0 80 00 04 30 40 00 08 30 46 00 4A 00 48 00 02 02 F0 62 1E 80 80 00 00 00 00 00 3F FF CC 0D 40 00 20 00 03 00 27 C3 01 C8 00 00 03 08 00 00 03 FF FF FF FC A4 04 00 00 62 00 18 02 00 50 00 00 00 00 00 00 00 00 00 00 00 00 00 01 90 01 90 00 C8 00 00 01 00 7E C8 00 C8 00 00 00 5D B0 81 40 00 00 00 00 00 00 00 00 00 00 00 00 02 C0 00 40 83 85 46 86 C7 07 8A 4A 80 70 0C 00 01 98 00 00 01 24 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 31 30 90 78 70 65 5F 6A 6F 69 6E 5F 70 6C 61 74 6F 6F 6E 92 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 31 34 8F 78 70 65 5F 6A 6F 69 6E 5F 6F 75 74 66 69 74 92 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 31 31 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 39 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 38 92 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 31 33 93 78 70 65 5F 77 61 72 70 5F 67 61 74 65 5F 75 73 61 67 65 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 32 92 78 70 65 5F 69 6E 73 74 61 6E 74 5F 61 63 74 69 6F 6E 8E 78 70 65 5F 66 6F 72 6D 5F 73 71 75 61 64 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 36 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 37 8E 78 70 65 5F 6A 6F 69 6E 5F 73 71 75 61 64 8C 78 70 65 5F 62 69 6E 64 5F 61 6D 73 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 35 91 78 70 65 5F 62 69 6E 64 5F 66 61 63 69 6C 69 74"
|
||||
val base =
|
||||
hex"18 D5 96 00 00 BC 8E 00 03 A2 16 5D A4 5F B0 80 00 04 30 40 00 08 30 46 00 4A 00 48 00 02 02 F0 62 1E 80 80 00 00 00 00 00 3F FF CC 0D 40 00 20 00 03 00 27 C3 01 C8 00 00 03 08 00 00 03 FF FF FF FC A4 04 00 00 62 00 18 02 00 50 00 00 00 00 00 00 00 00 00 00 00 00 00 01 90 01 90 00 C8 00 00 01 00 7E C8 00 C8 00 00 00 5D B0 81 40 00 00 00 00 00 00 00 00 00 00 00 00 02 C0 00 40 83 85 46 86 C7 07 8A 4A 80 70 0C 00 01 98 00 00 01 24 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 31 30 90 78 70 65 5F 6A 6F 69 6E 5F 70 6C 61 74 6F 6F 6E 92 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 31 34 8F 78 70 65 5F 6A 6F 69 6E 5F 6F 75 74 66 69 74 92 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 31 31 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 39 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 38 92 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 31 33 93 78 70 65 5F 77 61 72 70 5F 67 61 74 65 5F 75 73 61 67 65 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 32 92 78 70 65 5F 69 6E 73 74 61 6E 74 5F 61 63 74 69 6F 6E 8E 78 70 65 5F 66 6F 72 6D 5F 73 71 75 61 64 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 36 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 37 8E 78 70 65 5F 6A 6F 69 6E 5F 73 71 75 61 64 8C 78 70 65 5F 62 69 6E 64 5F 61 6D 73 91 78 70 65 5F 62 61 74 74 6C 65 5F 72 61 6E 6B 5F 35 91 78 70 65 5F 62 69 6E 64 5F 66 61 63 69 6C 69 74"
|
||||
val string = hex"00 00 01 CB" ++ base
|
||||
|
||||
"decode" in {
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class MultiPacketCollectorTest extends Specification {
|
|||
|
||||
"clear packets after being asked to bundle" in {
|
||||
val list = List(packet1, packet2)
|
||||
val obj = MultiPacketCollector(list)
|
||||
val obj = MultiPacketCollector(list)
|
||||
|
||||
obj.Bundle match {
|
||||
case Some(MultiPacketBundle(bundle)) =>
|
||||
|
|
@ -182,7 +182,7 @@ class MultiPacketCollectorTest extends Specification {
|
|||
obj2.Add(packet3)
|
||||
obj2.Add(bundle1)
|
||||
obj2.Bundle match {
|
||||
case Some(MultiPacketBundle(list))=>
|
||||
case Some(MultiPacketBundle(list)) =>
|
||||
list.size mustEqual 3
|
||||
list.head mustEqual packet3
|
||||
list(1) mustEqual packet1
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ class MultiPacketExTest extends Specification {
|
|||
|
||||
"decode" in {
|
||||
Fragment.foreach(strings.indices) { i =>
|
||||
"test "+i ! { MultiPacketEx.decode(strings{i}.bits).require.value mustEqual packets{i} }
|
||||
"test " + i ! { MultiPacketEx.decode(strings { i }.bits).require.value mustEqual packets { i } }
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
Fragment.foreach(packets.indices) { i =>
|
||||
"test "+i ! { MultiPacketEx.encode(packets{i}).require.toByteVector mustEqual strings{i} }
|
||||
"test " + i ! { MultiPacketEx.encode(packets { i }).require.toByteVector mustEqual strings { i } }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,14 +7,17 @@ import net.psforever.packet.control._
|
|||
import scodec.bits._
|
||||
|
||||
class MultiPacketTest extends Specification {
|
||||
val string = hex"00 03 04 00 15 13 23 3A 00 09 03 E3 00 19 16 6D 56 05 68 05 40 A0 EF 45 00 15 0E 44 00 A0 A2 41 00 00 0F 88 00 06 E4 C0 60 00 00 00 15 E4 32 40 74 72 61 69 6E 69 6E 67 5F 77 65 61 70 6F 6E 73 30 31 13 BD 68 05 53 F6 EF 90 D1 6E 03 14 FE 78 8C 20 1C C0 00 00 1F 00 09 03 E4 6D 56 05 68 05 40 A0 EF 45 00 15 0E 44 30 89 A1 41 00 00 0F 8A 01 00 04 18 EF 80"
|
||||
val string =
|
||||
hex"00 03 04 00 15 13 23 3A 00 09 03 E3 00 19 16 6D 56 05 68 05 40 A0 EF 45 00 15 0E 44 00 A0 A2 41 00 00 0F 88 00 06 E4 C0 60 00 00 00 15 E4 32 40 74 72 61 69 6E 69 6E 67 5F 77 65 61 70 6F 6E 73 30 31 13 BD 68 05 53 F6 EF 90 D1 6E 03 14 FE 78 8C 20 1C C0 00 00 1F 00 09 03 E4 6D 56 05 68 05 40 A0 EF 45 00 15 0E 44 30 89 A1 41 00 00 0F 8A 01 00 04 18 EF 80"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case MultiPacket(data) =>
|
||||
data.size mustEqual 4
|
||||
data(0) mustEqual hex"00151323"
|
||||
data(1) mustEqual hex"000903e30019166d5605680540a0ef4500150e4400a0a24100000f880006e4c06000000015e43240747261696e696e675f776561706f6e733031"
|
||||
data(
|
||||
1
|
||||
) mustEqual hex"000903e30019166d5605680540a0ef4500150e4400a0a24100000f880006e4c06000000015e43240747261696e696e675f776561706f6e733031"
|
||||
data(2) mustEqual hex"bd680553f6ef90d16e0314fe788c201cc00000"
|
||||
data(3) mustEqual hex"000903e46d5605680540a0ef4500150e443089a14100000f8a01000418ef80"
|
||||
case _ =>
|
||||
|
|
|
|||
|
|
@ -19,10 +19,14 @@ class SlottedMetaPacketTest extends Specification {
|
|||
hex"0069006400650021002000018667656D" ++
|
||||
hex"696E690100040001459E2540377540"
|
||||
|
||||
def createMetaPacket(slot : Int, subslot : Int, rest : ByteVector) = hex"00" ++
|
||||
ControlPacketOpcode.codec.encode(
|
||||
ControlPacketOpcode(ControlPacketOpcode.SlottedMetaPacket0.id + slot)
|
||||
).require.toByteVector ++ uint16.encode(subslot).require.toByteVector ++ rest
|
||||
def createMetaPacket(slot: Int, subslot: Int, rest: ByteVector) =
|
||||
hex"00" ++
|
||||
ControlPacketOpcode.codec
|
||||
.encode(
|
||||
ControlPacketOpcode(ControlPacketOpcode.SlottedMetaPacket0.id + slot)
|
||||
)
|
||||
.require
|
||||
.toByteVector ++ uint16.encode(subslot).require.toByteVector ++ rest
|
||||
|
||||
"decode as the base slot and subslot" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
|
|
@ -42,11 +46,10 @@ class SlottedMetaPacketTest extends Specification {
|
|||
Fragment.foreach(0 to maxSlots) { i =>
|
||||
"slot " + i ! {
|
||||
val subslot = 12323
|
||||
val pkt = createMetaPacket(i, subslot, ByteVector.empty)
|
||||
val pkt = createMetaPacket(i, subslot, ByteVector.empty)
|
||||
|
||||
PacketCoding.DecodePacket(pkt).require match {
|
||||
case SlottedMetaPacket(slot, subslotDecoded, rest) =>
|
||||
|
||||
// XXX: there isn't a simple solution to Slot0 and Slot4 be aliases of each other structurally
|
||||
// This is probably best left to higher layers
|
||||
//slot mustEqual i % 4 // this is seen at 0x00A3FBFA
|
||||
|
|
@ -61,7 +64,7 @@ class SlottedMetaPacketTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val encoded = PacketCoding.EncodePacket(SlottedMetaPacket(0, 0x1000, ByteVector.empty)).require
|
||||
val encoded = PacketCoding.EncodePacket(SlottedMetaPacket(0, 0x1000, ByteVector.empty)).require
|
||||
val encoded2 = PacketCoding.EncodePacket(SlottedMetaPacket(3, 0xffff, hex"414243")).require
|
||||
val encoded3 = PacketCoding.EncodePacket(SlottedMetaPacket(7, 0, hex"00")).require
|
||||
|
||||
|
|
|
|||
|
|
@ -8,16 +8,16 @@ import net.psforever.types.{PlanetSideEmpire, Vector3}
|
|||
import scodec.bits._
|
||||
|
||||
class AvatarDeadStateMessageTest extends Specification {
|
||||
val string = hex"ad3c1260801c12608009f99861fb0741e040000010"
|
||||
val string = hex"ad3c1260801c12608009f99861fb0741e040000010"
|
||||
val string_invalid = hex"ad3c1260801c12608009f99861fb0741e0400000F0"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case AvatarDeadStateMessage(unk1,unk2,unk3,pos,unk4,unk5) =>
|
||||
case AvatarDeadStateMessage(unk1, unk2, unk3, pos, unk4, unk5) =>
|
||||
unk1 mustEqual DeadState.Dead
|
||||
unk2 mustEqual 300000
|
||||
unk3 mustEqual 300000
|
||||
pos mustEqual Vector3(6552.617f,4602.375f,60.90625f)
|
||||
pos mustEqual Vector3(6552.617f, 4602.375f, 60.90625f)
|
||||
unk4 mustEqual PlanetSideEmpire.VS
|
||||
unk5 mustEqual true
|
||||
case _ =>
|
||||
|
|
@ -30,7 +30,14 @@ class AvatarDeadStateMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = AvatarDeadStateMessage(DeadState.Dead, 300000, 300000, Vector3(6552.617f,4602.375f,60.90625f), PlanetSideEmpire.VS, true)
|
||||
val msg = AvatarDeadStateMessage(
|
||||
DeadState.Dead,
|
||||
300000,
|
||||
300000,
|
||||
Vector3(6552.617f, 4602.375f, 60.90625f),
|
||||
PlanetSideEmpire.VS,
|
||||
true
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import scodec.bits._
|
|||
|
||||
class AvatarStatisticsMessageTest extends Specification {
|
||||
val string_long = hex"7F 4 00000000 0"
|
||||
val string_complex = hex"7F 01 3C 40 20 00 00 00 C0 00 00 00 00 00 00 00 20 00 00 00 20 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00"
|
||||
val string_complex =
|
||||
hex"7F 01 3C 40 20 00 00 00 C0 00 00 00 00 00 00 00 20 00 00 00 20 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00"
|
||||
|
||||
"decode (long)" in {
|
||||
PacketCoding.DecodePacket(string_long).require match {
|
||||
|
|
@ -51,29 +52,29 @@ class AvatarStatisticsMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (complex)" in {
|
||||
val msg = AvatarStatisticsMessage(0, Statistics(1, 572, List[Long](1,6,0,1,1,2,0,0)))
|
||||
val msg = AvatarStatisticsMessage(0, Statistics(1, 572, List[Long](1, 6, 0, 1, 1, 2, 0, 0)))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_complex
|
||||
}
|
||||
|
||||
"encode (failure; long; missing value)" in {
|
||||
val msg = AvatarStatisticsMessage(0, Statistics(None, None,List(0L)))
|
||||
val msg = AvatarStatisticsMessage(0, Statistics(None, None, List(0L)))
|
||||
PacketCoding.EncodePacket(msg).isFailure mustEqual true
|
||||
}
|
||||
|
||||
"encode (failure; complex; missing value (5-bit))" in {
|
||||
val msg = AvatarStatisticsMessage(0, Statistics(None, Some(572), List[Long](1,6,0,1,1,2,0,0)))
|
||||
val msg = AvatarStatisticsMessage(0, Statistics(None, Some(572), List[Long](1, 6, 0, 1, 1, 2, 0, 0)))
|
||||
PacketCoding.EncodePacket(msg).isFailure mustEqual true
|
||||
}
|
||||
|
||||
"encode (failure; complex; missing value (11-bit))" in {
|
||||
val msg = AvatarStatisticsMessage(0, Statistics(Some(1), None, List[Long](1,6,0,1,1,2,0,0)))
|
||||
val msg = AvatarStatisticsMessage(0, Statistics(Some(1), None, List[Long](1, 6, 0, 1, 1, 2, 0, 0)))
|
||||
PacketCoding.EncodePacket(msg).isFailure mustEqual true
|
||||
}
|
||||
|
||||
"encode (failure; complex; wrong number of list entries)" in {
|
||||
val msg = AvatarStatisticsMessage(0, Statistics(Some(1), None, List[Long](1,6,0,1)))
|
||||
val msg = AvatarStatisticsMessage(0, Statistics(Some(1), None, List[Long](1, 6, 0, 1)))
|
||||
PacketCoding.EncodePacket(msg).isFailure mustEqual true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import net.psforever.types.PlanetSideGUID
|
|||
import scodec.bits._
|
||||
|
||||
class AvatarVehicleTimerMessageTest extends Specification {
|
||||
val string = hex"57bd16866d65646b69740500000000"
|
||||
val string = hex"57bd16866d65646b69740500000000"
|
||||
val string2 = hex"57971b84667572794800000080"
|
||||
|
||||
"decode medkit" in {
|
||||
|
|
@ -35,13 +35,13 @@ class AvatarVehicleTimerMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode medkit" in {
|
||||
val msg = AvatarVehicleTimerMessage(PlanetSideGUID(5821),"medkit",5,false)
|
||||
val msg = AvatarVehicleTimerMessage(PlanetSideGUID(5821), "medkit", 5, false)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
"encode fury" in {
|
||||
val msg = AvatarVehicleTimerMessage(PlanetSideGUID(7063),"fury",72,true)
|
||||
val msg = AvatarVehicleTimerMessage(PlanetSideGUID(7063), "fury", 72, true)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string2
|
||||
|
|
|
|||
|
|
@ -7,11 +7,15 @@ import net.psforever.packet.game._
|
|||
import scodec.bits._
|
||||
|
||||
class BattleplanMessageTest extends Specification {
|
||||
val string_start = hex"b3 3a197902 94 59006500740041006e006f0074006800650072004600610069006c0075007200650041006c007400 0000 01 e0"
|
||||
val string_stop = hex"b3 3a197902 94 59006500740041006e006f0074006800650072004600610069006c0075007200650041006c007400 0000 01 f0"
|
||||
val string_line = hex"b3 85647702 8c 4f0075007400730074006100620075006c006f0075007300 0a00 20 2aba2b4aae8bd2aba334aae8dd2aca3b4ab28fd2aca414ab29152aca474ab292d2ada4d4ab69452ada534ab695d2ada594ab696d2ada5d4ab697d2ada614ab698d2ada654ab699d2ada694ab69ad2aea6d4aba9bd2aea714aba9cd2aea754aba9dd2aea794aba9ed"
|
||||
val string_start =
|
||||
hex"b3 3a197902 94 59006500740041006e006f0074006800650072004600610069006c0075007200650041006c007400 0000 01 e0"
|
||||
val string_stop =
|
||||
hex"b3 3a197902 94 59006500740041006e006f0074006800650072004600610069006c0075007200650041006c007400 0000 01 f0"
|
||||
val string_line =
|
||||
hex"b3 85647702 8c 4f0075007400730074006100620075006c006f0075007300 0a00 20 2aba2b4aae8bd2aba334aae8dd2aca3b4ab28fd2aca414ab29152aca474ab292d2ada4d4ab69452ada534ab695d2ada594ab696d2ada5d4ab697d2ada614ab698d2ada654ab699d2ada694ab69ad2aea6d4aba9bd2aea714aba9cd2aea754aba9dd2aea794aba9ed"
|
||||
val string_style = hex"b3856477028c4f0075007400730074006100620075006c006f00750073000a00031d22aba2f4aae8cd"
|
||||
val string_message = hex"b3 85647702 8c 4f0075007400730074006100620075006c006f0075007300 0a00 01 6aba2b5011c0480065006c006c006f00200041007500720061007800690073002100"
|
||||
val string_message =
|
||||
hex"b3 85647702 8c 4f0075007400730074006100620075006c006f0075007300 0a00 01 6aba2b5011c0480065006c006c006f00200041007500720061007800690073002100"
|
||||
//0xb3856477028c4f0075007400730074006100620075006c006f00750073000a000130
|
||||
|
||||
"decode (start)" in {
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ import scodec.bits._
|
|||
|
||||
class BindPlayerMessageTest extends Specification {
|
||||
val string_standard = hex"16028004000000000000000000000000000000"
|
||||
val string_ams = hex"16 05 8440616D73 08 28000000 00000000 00000 00000 0000"
|
||||
val string_tech = hex"16 01 8b40746563685f706c616e74 d4 28000000 38000000 00064 012b1 a044"
|
||||
val string_akkan = hex"16048440616d7388100000001400000214e171a8e33024"
|
||||
val string_ams = hex"16 05 8440616D73 08 28000000 00000000 00000 00000 0000"
|
||||
val string_tech = hex"16 01 8b40746563685f706c616e74 d4 28000000 38000000 00064 012b1 a044"
|
||||
val string_akkan = hex"16048440616d7388100000001400000214e171a8e33024"
|
||||
|
||||
"decode (standard)" in {
|
||||
PacketCoding.DecodePacket(string_standard).require match {
|
||||
|
|
@ -92,14 +92,32 @@ class BindPlayerMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (tech)" in {
|
||||
val msg = BindPlayerMessage(BindStatus.Bind, "@tech_plant", true, true, SpawnGroup.BoundFacility, 10, 14, Vector3(4610.0f, 6292, 69.625f))
|
||||
val msg = BindPlayerMessage(
|
||||
BindStatus.Bind,
|
||||
"@tech_plant",
|
||||
true,
|
||||
true,
|
||||
SpawnGroup.BoundFacility,
|
||||
10,
|
||||
14,
|
||||
Vector3(4610.0f, 6292, 69.625f)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_tech
|
||||
}
|
||||
|
||||
"encode (akkan)" in {
|
||||
val msg = BindPlayerMessage(BindStatus.Available, "@ams", true, false, SpawnGroup.AMS, 4, 5, Vector3(2673.039f, 4423.547f, 39.1875f))
|
||||
val msg = BindPlayerMessage(
|
||||
BindStatus.Available,
|
||||
"@ams",
|
||||
true,
|
||||
false,
|
||||
SpawnGroup.AMS,
|
||||
4,
|
||||
5,
|
||||
Vector3(2673.039f, 4423.547f, 39.1875f)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_akkan
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import net.psforever.types.Vector3
|
|||
import scodec.bits._
|
||||
|
||||
class BugReportMessageTest extends Specification {
|
||||
val string = hex"89 03000000 0F000000 8B4465632020322032303039 1 1 0 19 6C511 656B1 7A11 830610062006300 843100320033003400"
|
||||
val string =
|
||||
hex"89 03000000 0F000000 8B4465632020322032303039 1 1 0 19 6C511 656B1 7A11 830610062006300 843100320033003400"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
|
|
@ -30,9 +31,18 @@ class BugReportMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = BugReportMessage(3, 15, "Dec 2 2009",
|
||||
BugType.GAMEPLAY, true, 0, 25, Vector3(674.84375f, 726.78906f, 69.90625f),
|
||||
"abc", "1234")
|
||||
val msg = BugReportMessage(
|
||||
3,
|
||||
15,
|
||||
"Dec 2 2009",
|
||||
BugType.GAMEPLAY,
|
||||
true,
|
||||
0,
|
||||
25,
|
||||
Vector3(674.84375f, 726.78906f, 69.90625f),
|
||||
"abc",
|
||||
"1234"
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -12,27 +12,29 @@ class BuildingInfoUpdateMessageTest extends Specification {
|
|||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case BuildingInfoUpdateMessage(continent_guid,
|
||||
building_guid,
|
||||
ntu_level,
|
||||
is_hacked,
|
||||
empire_hack,
|
||||
hack_time_remaining,
|
||||
empire_own,
|
||||
unk1,
|
||||
unk1x,
|
||||
generator_state,
|
||||
spawn_tubes_normal,
|
||||
force_dome_active,
|
||||
lattice_benefit,
|
||||
unk3,
|
||||
unk4,
|
||||
unk5,
|
||||
unk6,
|
||||
unk7,
|
||||
unk7x,
|
||||
boost_spawn_pain,
|
||||
boost_generator_pain) =>
|
||||
case BuildingInfoUpdateMessage(
|
||||
continent_guid,
|
||||
building_guid,
|
||||
ntu_level,
|
||||
is_hacked,
|
||||
empire_hack,
|
||||
hack_time_remaining,
|
||||
empire_own,
|
||||
unk1,
|
||||
unk1x,
|
||||
generator_state,
|
||||
spawn_tubes_normal,
|
||||
force_dome_active,
|
||||
lattice_benefit,
|
||||
unk3,
|
||||
unk4,
|
||||
unk5,
|
||||
unk6,
|
||||
unk7,
|
||||
unk7x,
|
||||
boost_spawn_pain,
|
||||
boost_generator_pain
|
||||
) =>
|
||||
continent_guid mustEqual 4
|
||||
building_guid mustEqual 9
|
||||
ntu_level mustEqual 1
|
||||
|
|
@ -61,7 +63,8 @@ class BuildingInfoUpdateMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = BuildingInfoUpdateMessage(4,
|
||||
val msg = BuildingInfoUpdateMessage(
|
||||
4,
|
||||
9,
|
||||
1,
|
||||
false,
|
||||
|
|
@ -81,7 +84,8 @@ class BuildingInfoUpdateMessageTest extends Specification {
|
|||
8,
|
||||
None,
|
||||
false,
|
||||
false)
|
||||
false
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ class CharacterCreateRequestMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = CharacterCreateRequestMessage("TestChar", 50, CharacterVoice.Voice5, CharacterGender.Female, PlanetSideEmpire.NC)
|
||||
val msg =
|
||||
CharacterCreateRequestMessage("TestChar", 50, CharacterVoice.Voice5, CharacterGender.Female, PlanetSideEmpire.NC)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,4 +27,3 @@ class CharacterRequestMessageTest extends Specification {
|
|||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,11 +48,9 @@ class ChatMsgTest extends Specification {
|
|||
}
|
||||
|
||||
"allow and disallow note" in {
|
||||
ChatMsg(ChatMessageType.CMT_ARMOR,
|
||||
false,
|
||||
"DontCare", "DontCare", Some("Should be here")) must throwA[AssertionError]
|
||||
ChatMsg(ChatMessageType.CMT_NOTE,
|
||||
false,
|
||||
"DontCare", "DontCare", None) must throwA[AssertionError]
|
||||
ChatMsg(ChatMessageType.CMT_ARMOR, false, "DontCare", "DontCare", Some("Should be here")) must throwA[
|
||||
AssertionError
|
||||
]
|
||||
ChatMsg(ChatMessageType.CMT_NOTE, false, "DontCare", "DontCare", None) must throwA[AssertionError]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class ConnectToWorldRequestMessageTest extends Specification {
|
||||
val string = hex"03 8667656D696E69 0000000000000000 00000000 00000000 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 "
|
||||
val string =
|
||||
hex"03 8667656D696E69 0000000000000000 00000000 00000000 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 "
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ import scodec.bits._
|
|||
|
||||
class CreateShortcutMessageTest extends Specification {
|
||||
val stringMedkit = hex"28 7210 01 00 90 C0 6D65646B6974 80 80"
|
||||
val stringMacro = hex"28 4C05 08 00 B1 C0 73686F72746375745F6D6163726F 83 4E00 5400 5500 9B 2F00 7000 6C00 6100 7400 6F00 6F00 6E00 2000 4900 6E00 6300 6F00 6D00 6900 6E00 6700 2000 4E00 5400 5500 2000 7300 7000 6100 6D00 2100"
|
||||
val stringMacro =
|
||||
hex"28 4C05 08 00 B1 C0 73686F72746375745F6D6163726F 83 4E00 5400 5500 9B 2F00 7000 6C00 6100 7400 6F00 6F00 6E00 2000 4900 6E00 6300 6F00 6D00 6900 6E00 6700 2000 4E00 5400 5500 2000 7300 7000 6100 6D00 2100"
|
||||
val stringRemove = hex"28 4C05 01 00 00"
|
||||
|
||||
"decode (medkit)" in {
|
||||
|
|
@ -67,7 +68,13 @@ class CreateShortcutMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (macro)" in {
|
||||
val msg = CreateShortcutMessage(PlanetSideGUID(1356), 8, 0, true, Some(Shortcut(1, "shortcut_macro", "NTU", "/platoon Incoming NTU spam!")))
|
||||
val msg = CreateShortcutMessage(
|
||||
PlanetSideGUID(1356),
|
||||
8,
|
||||
0,
|
||||
true,
|
||||
Some(Shortcut(1, "shortcut_macro", "NTU", "/platoon Incoming NTU spam!"))
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual stringMacro
|
||||
|
|
@ -81,7 +88,7 @@ class CreateShortcutMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"macro" in {
|
||||
val MACRO : Some[Shortcut] = Shortcut.MACRO("NTU", "/platoon Incoming NTU spam!")
|
||||
val MACRO: Some[Shortcut] = Shortcut.MACRO("NTU", "/platoon Incoming NTU spam!")
|
||||
MACRO.get.purpose mustEqual 1
|
||||
MACRO.get.tile mustEqual "shortcut_macro"
|
||||
MACRO.get.effect1 mustEqual "NTU"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import net.psforever.types.PlanetSideGUID
|
|||
import scodec.bits._
|
||||
|
||||
class DamageFeedbackMessageTest extends Specification {
|
||||
val string = hex"7b 3d842f610b2040000000"
|
||||
val string = hex"7b 3d842f610b2040000000"
|
||||
val string_2 = hex"7B 5E5826D8001DC0400000"
|
||||
|
||||
"decode (string 1)" in {
|
||||
|
|
@ -54,14 +54,42 @@ class DamageFeedbackMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (string 1)" in {
|
||||
val msg = DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, None, true, Some(PlanetSideGUID(2913)), None, None, None, 1, 2, 0)
|
||||
val msg = DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
|
||||
"encode (string 2)" in {
|
||||
val msg = DamageFeedbackMessage(5, true, Some(PlanetSideGUID(2454)), None, None, false, Some(PlanetSideGUID(216)), None, None, None, 0, 750, 0)
|
||||
val msg = DamageFeedbackMessage(
|
||||
5,
|
||||
true,
|
||||
Some(PlanetSideGUID(2454)),
|
||||
None,
|
||||
None,
|
||||
false,
|
||||
Some(PlanetSideGUID(216)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
0,
|
||||
750,
|
||||
0
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_2
|
||||
|
|
@ -69,30 +97,254 @@ class DamageFeedbackMessageTest extends Specification {
|
|||
|
||||
"assert catches" in {
|
||||
//unk2: no parameters
|
||||
DamageFeedbackMessage(3, true, None, None, None, true, Some(PlanetSideGUID(2913)), None, None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
//unk2: two exclusive parameters
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), Some("error"), None, true, Some(PlanetSideGUID(2913)), None, None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, Some(5), true, Some(PlanetSideGUID(2913)), None, None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(3, true, None, Some("error"), Some(5), true, Some(PlanetSideGUID(2913)), None, None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
Some("error"),
|
||||
None,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
Some(5),
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
None,
|
||||
Some("error"),
|
||||
Some(5),
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
//unk2: all parameters
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), Some("error"), Some(5), true, Some(PlanetSideGUID(2913)), None, None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
Some("error"),
|
||||
Some(5),
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
//unk2: mismatched flag for strings
|
||||
DamageFeedbackMessage(3, true, None, None, Some(5), true, Some(PlanetSideGUID(2913)), None, None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(3, false, None, Some("error"), None, true, Some(PlanetSideGUID(2913)), None, None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
None,
|
||||
None,
|
||||
Some(5),
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
false,
|
||||
None,
|
||||
Some("error"),
|
||||
None,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
|
||||
//unk3: no parameters
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, None, true, None, None, None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
//unk3: two exclusive parameters
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, None, true, Some(PlanetSideGUID(2913)), Some("error"), None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, None, true, Some(PlanetSideGUID(2913)), None, Some(5), None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, None, true, None, Some("error"), Some(5), Some(1), 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
Some("error"),
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
Some(5),
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
None,
|
||||
Some("error"),
|
||||
Some(5),
|
||||
Some(1),
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
//unk3: all parameters
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, None, true, Some(PlanetSideGUID(2913)), Some("error"), Some(5), None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
Some("error"),
|
||||
Some(5),
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
//unk3: mismatched fields
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, None, true, Some(PlanetSideGUID(2913)), None, None, Some(5), 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, None, true, None, Some("Error"), None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
Some(5),
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
None,
|
||||
Some("Error"),
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
//unk3: mismatched flag for strings
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, None, true, None, None, Some(5), None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(3, true, Some(PlanetSideGUID(2913)), None, None, false, None, Some("error"), None, None, 1, 2, 0) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
None,
|
||||
None,
|
||||
Some(5),
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
DamageFeedbackMessage(
|
||||
3,
|
||||
true,
|
||||
Some(PlanetSideGUID(2913)),
|
||||
None,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
Some("error"),
|
||||
None,
|
||||
None,
|
||||
1,
|
||||
2,
|
||||
0
|
||||
) must throwA[AssertionError]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class DelayedPathMountMsgTest extends Specification {
|
|||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case DelayedPathMountMsg(player_guid, vehicle_guid,u3,u4) =>
|
||||
case DelayedPathMountMsg(player_guid, vehicle_guid, u3, u4) =>
|
||||
player_guid mustEqual PlanetSideGUID(1525)
|
||||
vehicle_guid mustEqual PlanetSideGUID(1155)
|
||||
u3 mustEqual 70
|
||||
|
|
@ -23,7 +23,7 @@ class DelayedPathMountMsgTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = DelayedPathMountMsg(PlanetSideGUID(1525), PlanetSideGUID(1155),70,true)
|
||||
val msg = DelayedPathMountMsg(PlanetSideGUID(1525), PlanetSideGUID(1155), 70, true)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class DensityLevelUpdateMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = DensityLevelUpdateMessage(1, 19999, List(0,0, 0,0, 0,0, 0,0))
|
||||
val msg = DensityLevelUpdateMessage(1, 19999, List(0, 0, 0, 0, 0, 0, 0, 0))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
@ -41,12 +41,12 @@ class DensityLevelUpdateMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (failure; list number too big)" in {
|
||||
val msg = DensityLevelUpdateMessage(1, 19999, List(0,0, 0,0, 0,0, 0,8))
|
||||
val msg = DensityLevelUpdateMessage(1, 19999, List(0, 0, 0, 0, 0, 0, 0, 8))
|
||||
PacketCoding.EncodePacket(msg).isSuccessful mustEqual false
|
||||
}
|
||||
|
||||
"encode (failure; list number too small)" in {
|
||||
val msg = DensityLevelUpdateMessage(1, 19999, List(0,0, 0,0, 0,-1, 0,0))
|
||||
val msg = DensityLevelUpdateMessage(1, 19999, List(0, 0, 0, 0, 0, -1, 0, 0))
|
||||
PacketCoding.EncodePacket(msg).isSuccessful mustEqual false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,13 @@ class DeployObjectMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = DeployObjectMessage(PlanetSideGUID(2932), 1000L, Vector3(5769.297f, 3192.8594f, 97.96875f), Vector3.z(272.8125f), 1L)
|
||||
val msg = DeployObjectMessage(
|
||||
PlanetSideGUID(2932),
|
||||
1000L,
|
||||
Vector3(5769.297f, 3192.8594f, 97.96875f),
|
||||
Vector3.z(272.8125f),
|
||||
1L
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ class DeployRequestMessageTest extends Specification {
|
|||
PlanetSideGUID(75),
|
||||
PlanetSideGUID(380),
|
||||
DriveState.Deploying,
|
||||
0, false,
|
||||
0,
|
||||
false,
|
||||
Vector3(4060.1953f, 2218.8281f, 155.32812f)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
|
|
|||
|
|
@ -30,7 +30,12 @@ class DeployableObjectsInfoMessageTest extends Specification {
|
|||
"encode" in {
|
||||
val msg = DeployableObjectsInfoMessage(
|
||||
DeploymentAction.Dismiss,
|
||||
DeployableInfo(PlanetSideGUID(2659), DeployableIcon.TRAP, Vector3(3572.4453f, 3277.9766f, 114.0f), PlanetSideGUID(2502))
|
||||
DeployableInfo(
|
||||
PlanetSideGUID(2659),
|
||||
DeployableIcon.TRAP,
|
||||
Vector3(3572.4453f, 3277.9766f, 114.0f),
|
||||
PlanetSideGUID(2502)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,23 @@ import net.psforever.types.PlanetSideEmpire
|
|||
import scodec.bits._
|
||||
|
||||
class DestroyDisplayMessageTest extends Specification {
|
||||
val string = hex"81 87 41006E00670065006C006C006F00 35BCD801 8 F201 9207 0A 0 48004D00460049004300 B18ED901 00" // Angello-VS (???) HMFIC-TR
|
||||
val string =
|
||||
hex"81 87 41006E00670065006C006C006F00 35BCD801 8 F201 9207 0A 0 48004D00460049004300 B18ED901 00" // Angello-VS (???) HMFIC-TR
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case DestroyDisplayMessage(killer, killer_charId, killer_empire, killer_inVehicle, unk, method, victim, victim_charId, victim_empire, victim_inVehicle) =>
|
||||
case DestroyDisplayMessage(
|
||||
killer,
|
||||
killer_charId,
|
||||
killer_empire,
|
||||
killer_inVehicle,
|
||||
unk,
|
||||
method,
|
||||
victim,
|
||||
victim_charId,
|
||||
victim_empire,
|
||||
victim_inVehicle
|
||||
) =>
|
||||
killer mustEqual "Angello"
|
||||
killer_charId mustEqual 30981173
|
||||
killer_empire mustEqual PlanetSideEmpire.VS
|
||||
|
|
@ -29,7 +41,18 @@ class DestroyDisplayMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = DestroyDisplayMessage("Angello", 30981173, PlanetSideEmpire.VS, false, 121, 969, "HMFIC", 31035057, PlanetSideEmpire.TR, false)
|
||||
val msg = DestroyDisplayMessage(
|
||||
"Angello",
|
||||
30981173,
|
||||
PlanetSideEmpire.VS,
|
||||
false,
|
||||
121,
|
||||
969,
|
||||
"HMFIC",
|
||||
31035057,
|
||||
PlanetSideEmpire.TR,
|
||||
false
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,12 @@ class DestroyMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = DestroyMessage(PlanetSideGUID(2420), PlanetSideGUID(2420), PlanetSideGUID(0), Vector3(1642.0469f, 4091.6172f, 32.59375f))
|
||||
val msg = DestroyMessage(
|
||||
PlanetSideGUID(2420),
|
||||
PlanetSideGUID(2420),
|
||||
PlanetSideGUID(0),
|
||||
Vector3(1642.0469f, 4091.6172f, 32.59375f)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import net.psforever.types.{PlanetSideGUID, Vector3}
|
|||
import scodec.bits._
|
||||
|
||||
class DroppodFreefallingMessageTest extends Specification {
|
||||
val string = hex"68 220e 00e0b245 00c06145 00a08744 00000000 00000000 ffff79c4 0740b245 22c66145 00608144 00 67 3f 00 00 3f"
|
||||
val string =
|
||||
hex"68 220e 00e0b245 00c06145 00a08744 00000000 00000000 ffff79c4 0740b245 22c66145 00608144 00 67 3f 00 00 3f"
|
||||
|
||||
"DroppodFreefallingMessage" should {
|
||||
"decode" in {
|
||||
|
|
@ -31,7 +32,9 @@ class DroppodFreefallingMessageTest extends Specification {
|
|||
Vector3(5724, 3612, 1085),
|
||||
Vector3(0, 0, -999.99994f),
|
||||
Vector3(5704.0034f, 3612.3833f, 1035.0f),
|
||||
Vector3(0, 70.3125f, 272.8125f), Vector3(0, 0, 272.8125f))
|
||||
Vector3(0, 70.3125f, 272.8125f),
|
||||
Vector3(0, 0, 272.8125f)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -26,4 +26,3 @@ class FacilityBenefitShieldChargeRequestMessageTest extends Specification {
|
|||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,4 +31,3 @@ class FavoritesRequestTest extends Specification {
|
|||
pkt mustEqual stringInfantry
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class FireHintMessageTest extends Specification {
|
|||
PacketCoding.DecodePacket(string).require match {
|
||||
case FireHintMessage(weapon_guid, pos, u1, u2, u3, u4, u5) =>
|
||||
weapon_guid mustEqual PlanetSideGUID(5889)
|
||||
pos mustEqual Vector3(3482.2734f,3642.4922f,53.125f)
|
||||
pos mustEqual Vector3(3482.2734f, 3642.4922f, 53.125f)
|
||||
u1 mustEqual 0
|
||||
u2 mustEqual 65399
|
||||
u3 mustEqual 7581
|
||||
|
|
@ -29,25 +29,33 @@ class FireHintMessageTest extends Specification {
|
|||
PacketCoding.DecodePacket(string2).require match {
|
||||
case FireHintMessage(weapon_guid, pos, u1, u2, u3, u4, u5) =>
|
||||
weapon_guid mustEqual PlanetSideGUID(3592)
|
||||
pos mustEqual Vector3(2910.789f,3744.875f,69.0625f)
|
||||
pos mustEqual Vector3(2910.789f, 3744.875f, 69.0625f)
|
||||
u1 mustEqual 0
|
||||
u2 mustEqual 65231
|
||||
u3 mustEqual 64736
|
||||
u4 mustEqual 3
|
||||
u5 mustEqual Some(Vector3(21.5f,-6.8125f,2.65625f))
|
||||
u5 mustEqual Some(Vector3(21.5f, -6.8125f, 2.65625f))
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = FireHintMessage(PlanetSideGUID(5889), Vector3(3482.2734f,3642.4922f,53.125f), 0, 65399, 7581, 0)
|
||||
val msg = FireHintMessage(PlanetSideGUID(5889), Vector3(3482.2734f, 3642.4922f, 53.125f), 0, 65399, 7581, 0)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
"encode string2" in {
|
||||
val msg = FireHintMessage(PlanetSideGUID(3592), Vector3(2910.789f,3744.875f,69.0625f), 0, 65231, 64736, 3, Some(Vector3(21.5f,-6.8125f,2.65625f)))
|
||||
val msg = FireHintMessage(
|
||||
PlanetSideGUID(3592),
|
||||
Vector3(2910.789f, 3744.875f, 69.0625f),
|
||||
0,
|
||||
65231,
|
||||
64736,
|
||||
3,
|
||||
Some(Vector3(21.5f, -6.8125f, 2.65625f))
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string2
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import scodec.bits._
|
|||
|
||||
class FriendsResponseTest extends Specification {
|
||||
val stringOneFriend = hex"73 61 8C 60 4B007500720074004800650063007400690063002D004700 00"
|
||||
val stringManyFriends = hex"73 01 AC 48 4100 6E00 6700 6500 6C00 6C00 6F00 2D00 5700 47 00 7400 6800 6500 7000 6800 6100 7400 7400 7000 6800 7200 6F00 6700 6700 46 80 4B00 6900 6D00 7000 6F00 7300 7300 6900 6200 6C00 6500 3100 3200 45 00 5A00 6500 6100 7200 7400 6800 6C00 6900 6E00 6700 46 00 4B00 7500 7200 7400 4800 6500 6300 7400 6900 6300 2D00 4700 00"
|
||||
val stringManyFriends =
|
||||
hex"73 01 AC 48 4100 6E00 6700 6500 6C00 6C00 6F00 2D00 5700 47 00 7400 6800 6500 7000 6800 6100 7400 7400 7000 6800 7200 6F00 6700 6700 46 80 4B00 6900 6D00 7000 6F00 7300 7300 6900 6200 6C00 6500 3100 3200 45 00 5A00 6500 6100 7200 7400 6800 6C00 6900 6E00 6700 46 00 4B00 7500 7200 7400 4800 6500 6300 7400 6900 6300 2D00 4700 00"
|
||||
val stringShort = hex"73 81 80"
|
||||
|
||||
"decode (one friend)" in {
|
||||
|
|
@ -63,22 +64,32 @@ class FriendsResponseTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (one friend)" in {
|
||||
val msg = FriendsResponse(FriendAction.UpdateFriend, 0, true, true,
|
||||
val msg = FriendsResponse(
|
||||
FriendAction.UpdateFriend,
|
||||
0,
|
||||
true,
|
||||
true,
|
||||
Friend("KurtHectic-G", false) ::
|
||||
Nil)
|
||||
Nil
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual stringOneFriend
|
||||
}
|
||||
|
||||
"encode (multiple friends)" in {
|
||||
val msg = FriendsResponse(FriendAction.InitializeFriendList, 0, true, true,
|
||||
val msg = FriendsResponse(
|
||||
FriendAction.InitializeFriendList,
|
||||
0,
|
||||
true,
|
||||
true,
|
||||
Friend("Angello-W", false) ::
|
||||
Friend("thephattphrogg", false) ::
|
||||
Friend("Kimpossible12", false) ::
|
||||
Friend("Zearthling", false) ::
|
||||
Friend("KurtHectic-G", false) ::
|
||||
Nil)
|
||||
Nil
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual stringManyFriends
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ import scodec.bits._
|
|||
|
||||
class GenericCollisionMsgTest extends Specification {
|
||||
//TODO find a better test later
|
||||
val string = hex"3C 92C00000190000001B2A8010932CEF505C70946F00000000000000000000000017725EBC6D6A058000000000000000000000000000003F8FF45140"
|
||||
val string =
|
||||
hex"3C 92C00000190000001B2A8010932CEF505C70946F00000000000000000000000017725EBC6D6A058000000000000000000000000000003F8FF45140"
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case GenericCollisionMsg(unk1, p, t, php, thp, pv, tv, ppos, tpos, unk2, unk3, unk4) =>
|
||||
|
|
@ -38,7 +39,20 @@ class GenericCollisionMsgTest extends Specification {
|
|||
}
|
||||
}
|
||||
"encode" in {
|
||||
val msg = GenericCollisionMsg(2, PlanetSideGUID(75), PlanetSideGUID(0), 100, 0, Vector3(32.166428f, 23.712547f, -0.012802706f), Vector3(0.0f, 0.0f, 0.0f), Vector3(3986.7266f, 2615.3672f, 90.625f), Vector3(0.0f, 0.0f, 0.0f), 0L, 0L, 1171341310L)
|
||||
val msg = GenericCollisionMsg(
|
||||
2,
|
||||
PlanetSideGUID(75),
|
||||
PlanetSideGUID(0),
|
||||
100,
|
||||
0,
|
||||
Vector3(32.166428f, 23.712547f, -0.012802706f),
|
||||
Vector3(0.0f, 0.0f, 0.0f),
|
||||
Vector3(3986.7266f, 2615.3672f, 90.625f),
|
||||
Vector3(0.0f, 0.0f, 0.0f),
|
||||
0L,
|
||||
0L,
|
||||
1171341310L
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import scodec.bits._
|
|||
|
||||
class HitMessageTest extends Specification {
|
||||
val string_hitgeneric = hex"09 09E9A70200"
|
||||
val string_hitobj = hex"09 99292705F4B1FB9514585F08BDD3D454CC5EE80300"
|
||||
val string_hitobj = hex"09 99292705F4B1FB9514585F08BDD3D454CC5EE80300"
|
||||
|
||||
"decode (generic)" in {
|
||||
PacketCoding.DecodePacket(string_hitgeneric).require match {
|
||||
|
|
@ -32,7 +32,13 @@ class HitMessageTest extends Specification {
|
|||
seq_time mustEqual 153
|
||||
projectile_guid mustEqual PlanetSideGUID(40100)
|
||||
unk1 mustEqual 0
|
||||
hit_info mustEqual Some(HitInfo(Vector3(3672.9766f, 2729.8594f, 92.34375f), Vector3(3679.5156f, 2722.6172f, 92.796875f), Some(PlanetSideGUID(372))))
|
||||
hit_info mustEqual Some(
|
||||
HitInfo(
|
||||
Vector3(3672.9766f, 2729.8594f, 92.34375f),
|
||||
Vector3(3679.5156f, 2722.6172f, 92.796875f),
|
||||
Some(PlanetSideGUID(372))
|
||||
)
|
||||
)
|
||||
unk2 mustEqual true
|
||||
unk3 mustEqual false
|
||||
unk4 mustEqual None
|
||||
|
|
@ -48,7 +54,21 @@ class HitMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (object)" in {
|
||||
val msg_hitobj = HitMessage(153, PlanetSideGUID(40100), 0, Some(HitInfo(Vector3(3672.9766f, 2729.8594f, 92.34375f), Vector3(3679.5156f, 2722.6172f, 92.796875f), Some(PlanetSideGUID(372)))), true, false, None)
|
||||
val msg_hitobj = HitMessage(
|
||||
153,
|
||||
PlanetSideGUID(40100),
|
||||
0,
|
||||
Some(
|
||||
HitInfo(
|
||||
Vector3(3672.9766f, 2729.8594f, 92.34375f),
|
||||
Vector3(3679.5156f, 2722.6172f, 92.796875f),
|
||||
Some(PlanetSideGUID(372))
|
||||
)
|
||||
),
|
||||
true,
|
||||
false,
|
||||
None
|
||||
)
|
||||
val pkt_hitobj = PacketCoding.EncodePacket(msg_hitobj).require.toByteVector
|
||||
|
||||
pkt_hitobj mustEqual string_hitobj
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import scodec.bits._
|
|||
|
||||
class HotSpotUpdateMessageTest extends Specification {
|
||||
val stringClear = hex"9F 0500 1 000"
|
||||
val stringOne = hex"9F 0500 1 010 002E9 00145 80000 0"
|
||||
val stringTwo = hex"9F 0500 5 020 00D07 008CA 80000 00BEA 004C4 80000"
|
||||
val stringOne = hex"9F 0500 1 010 002E9 00145 80000 0"
|
||||
val stringTwo = hex"9F 0500 5 020 00D07 008CA 80000 00BEA 004C4 80000"
|
||||
val stringThree = hex"9F 0A00 4 030 00FC8 00F0A 80000 002E9 00BEA 80000 00FC8 00BEA 80000 0"
|
||||
|
||||
"decode (clear)" in {
|
||||
|
|
@ -64,25 +64,34 @@ class HotSpotUpdateMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (clear)" in {
|
||||
val msg = HotSpotUpdateMessage(5,1, Nil)
|
||||
val msg = HotSpotUpdateMessage(5, 1, Nil)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual stringClear
|
||||
}
|
||||
|
||||
"encode (one)" in {
|
||||
val msg = HotSpotUpdateMessage(5,1, List(HotSpotInfo(4700.0f, 2600.0f, 64.0f)))
|
||||
val msg = HotSpotUpdateMessage(5, 1, List(HotSpotInfo(4700.0f, 2600.0f, 64.0f)))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual stringOne
|
||||
}
|
||||
|
||||
"encode (two)" in {
|
||||
val msg = HotSpotUpdateMessage(5,5, List(HotSpotInfo(4000.0f, 5400.0f, 64.0f), HotSpotInfo(5500.0f, 2200.0f, 64.0f)))
|
||||
val msg =
|
||||
HotSpotUpdateMessage(5, 5, List(HotSpotInfo(4000.0f, 5400.0f, 64.0f), HotSpotInfo(5500.0f, 2200.0f, 64.0f)))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual stringTwo
|
||||
}
|
||||
|
||||
"encode (three)" in {
|
||||
val msg = HotSpotUpdateMessage(10,4, List(HotSpotInfo(4600.0f, 5600.0f, 64.0f), HotSpotInfo(4700.0f, 5500.0f, 64.0f), HotSpotInfo(4600.0f, 5500.0f, 64.0f)))
|
||||
val msg = HotSpotUpdateMessage(
|
||||
10,
|
||||
4,
|
||||
List(
|
||||
HotSpotInfo(4600.0f, 5600.0f, 64.0f),
|
||||
HotSpotInfo(4700.0f, 5500.0f, 64.0f),
|
||||
HotSpotInfo(4600.0f, 5500.0f, 64.0f)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual stringThree
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,3 @@ class InventoryStateMessageTest extends Specification {
|
|||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import net.psforever.types.{PlanetSideGUID, TransactionType}
|
|||
import scodec.bits._
|
||||
|
||||
class ItemTransactionMessageTest extends Specification {
|
||||
val string_buy = hex"44 4C03 4000110070756E6973686572000000"
|
||||
val string_sell = hex"44 5303 60001000004E00"
|
||||
val string_buy = hex"44 4C03 4000110070756E6973686572000000"
|
||||
val string_sell = hex"44 5303 60001000004E00"
|
||||
val string_forget = hex"44 BA00 600011006861726173736572000000"
|
||||
|
||||
"decode (buy)" in {
|
||||
|
|
@ -68,7 +68,8 @@ class ItemTransactionMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (forget)" in {
|
||||
val msg_forget = ItemTransactionMessage(PlanetSideGUID(186), TransactionType.Sell, 0, "harasser", 0, PlanetSideGUID(0))
|
||||
val msg_forget =
|
||||
ItemTransactionMessage(PlanetSideGUID(186), TransactionType.Sell, 0, "harasser", 0, PlanetSideGUID(0))
|
||||
val pkt_forget = PacketCoding.EncodePacket(msg_forget).require.toByteVector
|
||||
|
||||
pkt_forget mustEqual string_forget
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import scodec.bits._
|
|||
class ItemTransactionResultMessageTest extends Specification {
|
||||
//these are paried packets come from the same capture
|
||||
val string_request = hex"44 DD 03 40 00 11 40 73 75 70 70 72 65 73 73 6F 72 00 00 00"
|
||||
val string_result = hex"45 DD 03 50 00"
|
||||
val string_result = hex"45 DD 03 50 00"
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string_result).require match {
|
||||
case ItemTransactionResultMessage(terminal_guid, transaction_type, is_success, error_code) =>
|
||||
|
|
@ -33,12 +33,11 @@ class ItemTransactionResultMessageTest extends Specification {
|
|||
"proper reply" in {
|
||||
try {
|
||||
val request = PacketCoding.DecodePacket(string_request).require.asInstanceOf[ItemTransactionMessage]
|
||||
val result = PacketCoding.DecodePacket(string_result).require.asInstanceOf[ItemTransactionResultMessage]
|
||||
val result = PacketCoding.DecodePacket(string_result).require.asInstanceOf[ItemTransactionResultMessage]
|
||||
request.terminal_guid mustEqual result.terminal_guid
|
||||
request.transaction_type mustEqual result.transaction_type
|
||||
}
|
||||
catch {
|
||||
case e : Exception =>
|
||||
} catch {
|
||||
case e: Exception =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,4 +25,3 @@ class KeepAliveMessageTest extends Specification {
|
|||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ class LashMessageTest extends Specification {
|
|||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case LashMessage(seq_time,player,victim,bullet,pos,unk1) =>
|
||||
case LashMessage(seq_time, player, victim, bullet, pos, unk1) =>
|
||||
seq_time mustEqual 356
|
||||
player mustEqual PlanetSideGUID(2858)
|
||||
victim mustEqual PlanetSideGUID(2699)
|
||||
bullet mustEqual PlanetSideGUID(40030)
|
||||
pos mustEqual Vector3(5903.7656f,3456.5156f,111.53125f)
|
||||
pos mustEqual Vector3(5903.7656f, 3456.5156f, 111.53125f)
|
||||
unk1 mustEqual 0
|
||||
case _ =>
|
||||
ko
|
||||
|
|
@ -25,7 +25,14 @@ class LashMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = LashMessage(356, PlanetSideGUID(2858), PlanetSideGUID(2699), PlanetSideGUID(40030), Vector3(5903.7656f,3456.5156f,111.53125f), 0)
|
||||
val msg = LashMessage(
|
||||
356,
|
||||
PlanetSideGUID(2858),
|
||||
PlanetSideGUID(2699),
|
||||
PlanetSideGUID(40030),
|
||||
Vector3(5903.7656f, 3456.5156f, 111.53125f),
|
||||
0
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class LoadMapMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = LoadMapMessage("map10","z10",40975,25,true,230810349)
|
||||
val msg = LoadMapMessage("map10", "z10", 40975, 25, true, 230810349)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import scodec.bits._
|
|||
|
||||
class LoginMessageTest extends Specification {
|
||||
val string_password = hex"0x01030000000f0000008b4465632020322032303039408061816154000000"
|
||||
val string_token = hex"0x01030000000f0000008b4465632020322032303039a0a0a0a0a121212121a1a1a1a222222222a2a2a2a323232323a3a3a3a424240040806154000000"
|
||||
val string_token =
|
||||
hex"0x01030000000f0000008b4465632020322032303039a0a0a0a0a121212121a1a1a1a222222222a2a2a2a323232323a3a3a3a424240040806154000000"
|
||||
|
||||
"LoginMessage" should {
|
||||
"decode (username)" in {
|
||||
|
|
|
|||
|
|
@ -20,16 +20,30 @@ class LoginRespMessageTest extends Specification {
|
|||
hex"00000000 01000000 02000000 6B7BD828 8C4169666671756F7469656E74 11270000 80"
|
||||
|
||||
"encode" in {
|
||||
val msg = LoginRespMessage("HaHLdYzs0VASjksR", LoginError.Success, StationError.AccountActive,
|
||||
StationSubscriptionStatus.Active, 685276011, "Aiffquotient", 0)
|
||||
val msg = LoginRespMessage(
|
||||
"HaHLdYzs0VASjksR",
|
||||
LoginError.Success,
|
||||
StationError.AccountActive,
|
||||
StationSubscriptionStatus.Active,
|
||||
685276011,
|
||||
"Aiffquotient",
|
||||
0
|
||||
)
|
||||
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string
|
||||
}
|
||||
|
||||
"encode with privilege" in {
|
||||
val msg = LoginRespMessage("HaHLdYzs0VASjksR", LoginError.Success, StationError.AccountActive,
|
||||
StationSubscriptionStatus.Active, 685276011, "Aiffquotient", 10001)
|
||||
val msg = LoginRespMessage(
|
||||
"HaHLdYzs0VASjksR",
|
||||
LoginError.Success,
|
||||
StationError.AccountActive,
|
||||
StationSubscriptionStatus.Active,
|
||||
685276011,
|
||||
"Aiffquotient",
|
||||
10001
|
||||
)
|
||||
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_priv
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class LootItemMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = LootItemMessage(PlanetSideGUID(3549),PlanetSideGUID(5212))
|
||||
val msg = LootItemMessage(PlanetSideGUID(3549), PlanetSideGUID(5212))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import scodec.bits._
|
|||
|
||||
class ObjectAttachMessageTest extends Specification {
|
||||
val stringToInventory = hex"2A 9F05 D405 86"
|
||||
val stringToCursor = hex"2A 9F05 D405 00FA"
|
||||
val stringToCursor = hex"2A 9F05 D405 00FA"
|
||||
|
||||
"decode (inventory 1,1)" in {
|
||||
PacketCoding.DecodePacket(stringToInventory).require match {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class ObjectDeployedMessageTest extends Specification {
|
|||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string_boomer).require match {
|
||||
case ObjectDeployedMessage(unk : Int, desc : String, act : DeployOutcome.Value, count : Long, max : Long) =>
|
||||
case ObjectDeployedMessage(unk: Int, desc: String, act: DeployOutcome.Value, count: Long, max: Long) =>
|
||||
unk mustEqual 0
|
||||
desc mustEqual "boomer"
|
||||
act mustEqual DeployOutcome.Success
|
||||
|
|
|
|||
|
|
@ -27,21 +27,34 @@ class ObjectDetachMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (1)" in {
|
||||
val msg = ObjectDetachMessage(PlanetSideGUID(2916), PlanetSideGUID(2502), Vector3(3567.1406f, 2988.0078f, 71.84375f), 0f, 0f, 270f)
|
||||
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 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 msg =
|
||||
ObjectDetachMessage(PlanetSideGUID(2916), PlanetSideGUID(2502), Vector3(3567.1406f, 2988.0078f, 71.84375f), 270f)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import net.psforever.types.PlanetSideGUID
|
|||
import scodec.bits._
|
||||
|
||||
class OrbitalStrikeWaypointMessageTest extends Specification {
|
||||
val string_on = hex"B9 46 0C AA E3 D2 2A 92 00"
|
||||
val string_on = hex"B9 46 0C AA E3 D2 2A 92 00"
|
||||
val string_off = hex"B9 46 0C 00"
|
||||
|
||||
"decode (on)" in {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import net.psforever.types.PlanetSideGUID
|
|||
import scodec.bits._
|
||||
|
||||
class OxygenStateMessageTest extends Specification {
|
||||
val string_self = hex"78 4b00f430"
|
||||
val string_self = hex"78 4b00f430"
|
||||
val string_vehicle = hex"78 4b00f4385037a180"
|
||||
|
||||
"decode (self)" in {
|
||||
|
|
@ -46,7 +46,8 @@ class OxygenStateMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (vehicle)" in {
|
||||
val msg = OxygenStateMessage(PlanetSideGUID(75), 50.0f, true, WaterloggedVehicleState(PlanetSideGUID(1546), 50.0f, true))
|
||||
val msg =
|
||||
OxygenStateMessage(PlanetSideGUID(75), 50.0f, true, WaterloggedVehicleState(PlanetSideGUID(1546), 50.0f, true))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_vehicle
|
||||
|
|
|
|||
|
|
@ -9,12 +9,25 @@ import scodec.bits._
|
|||
|
||||
class PlayerStateMessageTest extends Specification {
|
||||
val string_short = hex"08 A006 DFD17 B5AEB 380B 0F80002990"
|
||||
val string_mod = hex"08 A006 DFD17 B5AEB 380B 0F80002985" //slightly modified from above to demonstrate active booleans
|
||||
val string_mod =
|
||||
hex"08 A006 DFD17 B5AEB 380B 0F80002985" //slightly modified from above to demonstrate active booleans
|
||||
val string_vel = hex"08 A006 4DD47 CDB1B 0C0B A8C1A5000403008014A4"
|
||||
|
||||
"decode (short)" in {
|
||||
PacketCoding.DecodePacket(string_short).require match {
|
||||
case PlayerStateMessage(guid, pos, vel, facingYaw, facingPitch, facingUpper, unk1, crouching, jumping, jthrust, cloaked) =>
|
||||
case PlayerStateMessage(
|
||||
guid,
|
||||
pos,
|
||||
vel,
|
||||
facingYaw,
|
||||
facingPitch,
|
||||
facingUpper,
|
||||
unk1,
|
||||
crouching,
|
||||
jumping,
|
||||
jthrust,
|
||||
cloaked
|
||||
) =>
|
||||
guid mustEqual PlanetSideGUID(1696)
|
||||
pos.x mustEqual 4003.7422f
|
||||
pos.y mustEqual 5981.414f
|
||||
|
|
@ -35,7 +48,19 @@ class PlayerStateMessageTest extends Specification {
|
|||
|
||||
"decode (mod)" in {
|
||||
PacketCoding.DecodePacket(string_mod).require match {
|
||||
case PlayerStateMessage(guid, pos, vel, facingYaw, facingPitch, facingUpper, unk1, crouching, jumping, jthrust, cloaked) =>
|
||||
case PlayerStateMessage(
|
||||
guid,
|
||||
pos,
|
||||
vel,
|
||||
facingYaw,
|
||||
facingPitch,
|
||||
facingUpper,
|
||||
unk1,
|
||||
crouching,
|
||||
jumping,
|
||||
jthrust,
|
||||
cloaked
|
||||
) =>
|
||||
guid mustEqual PlanetSideGUID(1696)
|
||||
pos.x mustEqual 4003.7422f
|
||||
pos.y mustEqual 5981.414f
|
||||
|
|
@ -56,7 +81,19 @@ class PlayerStateMessageTest extends Specification {
|
|||
|
||||
"decode (vel)" in {
|
||||
PacketCoding.DecodePacket(string_vel).require match {
|
||||
case PlayerStateMessage(guid, pos, vel, facingYaw, facingPitch, facingUpper, unk1, crouching, jumping, jthrust, cloaked) =>
|
||||
case PlayerStateMessage(
|
||||
guid,
|
||||
pos,
|
||||
vel,
|
||||
facingYaw,
|
||||
facingPitch,
|
||||
facingUpper,
|
||||
unk1,
|
||||
crouching,
|
||||
jumping,
|
||||
jthrust,
|
||||
cloaked
|
||||
) =>
|
||||
guid mustEqual PlanetSideGUID(1696)
|
||||
pos.x mustEqual 4008.6016f
|
||||
pos.y mustEqual 5987.6016f
|
||||
|
|
@ -83,8 +120,15 @@ class PlayerStateMessageTest extends Specification {
|
|||
PlanetSideGUID(1696),
|
||||
Vector3(4003.7422f, 5981.414f, 44.875f),
|
||||
None,
|
||||
2.8125f, 0f, 0f, 83,
|
||||
false, false, false, false)
|
||||
2.8125f,
|
||||
0f,
|
||||
0f,
|
||||
83,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_short
|
||||
}
|
||||
|
|
@ -94,8 +138,15 @@ class PlayerStateMessageTest extends Specification {
|
|||
PlanetSideGUID(1696),
|
||||
Vector3(4003.7422f, 5981.414f, 44.875f),
|
||||
None,
|
||||
2.8125f, 0f, 0f, 83,
|
||||
false, true, false, true)
|
||||
2.8125f,
|
||||
0f,
|
||||
0f,
|
||||
83,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_mod
|
||||
}
|
||||
|
|
@ -105,8 +156,15 @@ class PlayerStateMessageTest extends Specification {
|
|||
PlanetSideGUID(1696),
|
||||
Vector3(4008.6016f, 5987.6016f, 44.1875f),
|
||||
Some(Vector3(2.53125f, 6.5625f, 0f)),
|
||||
22.5f, -11.25f, 0f, 165,
|
||||
false, false, false, false)
|
||||
22.5f,
|
||||
-11.25f,
|
||||
0f,
|
||||
165,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_vel
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,22 @@ class PlayerStateMessageUpstreamTest extends Specification {
|
|||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case PlayerStateMessageUpstream(avatar_guid, pos, vel, facingYaw, facingPitch, facingYawUpper, seq_time, unk1, is_crouching, is_jumping, jump_thrust, is_cloaked, unk2, unk3) =>
|
||||
case PlayerStateMessageUpstream(
|
||||
avatar_guid,
|
||||
pos,
|
||||
vel,
|
||||
facingYaw,
|
||||
facingPitch,
|
||||
facingYawUpper,
|
||||
seq_time,
|
||||
unk1,
|
||||
is_crouching,
|
||||
is_jumping,
|
||||
jump_thrust,
|
||||
is_cloaked,
|
||||
unk2,
|
||||
unk3
|
||||
) =>
|
||||
avatar_guid mustEqual PlanetSideGUID(75)
|
||||
pos mustEqual Vector3(3694.1094f, 2735.4531f, 90.84375f)
|
||||
vel.contains(Vector3(4.375f, 2.59375f, 0.0f)) mustEqual true
|
||||
|
|
@ -33,7 +48,22 @@ class PlayerStateMessageUpstreamTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = PlayerStateMessageUpstream(PlanetSideGUID(75), Vector3(3694.1094f, 2735.4531f, 90.84375f), Some(Vector3(4.375f, 2.59375f, 0.0f)), 61.875f, -8.4375f, 0.0f, 136, 0, false, false, false, false, 112, 0)
|
||||
val msg = PlayerStateMessageUpstream(
|
||||
PlanetSideGUID(75),
|
||||
Vector3(3694.1094f, 2735.4531f, 90.84375f),
|
||||
Some(Vector3(4.375f, 2.59375f, 0.0f)),
|
||||
61.875f,
|
||||
-8.4375f,
|
||||
0.0f,
|
||||
136,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
112,
|
||||
0
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import net.psforever.types.Vector3
|
|||
import scodec.bits._
|
||||
|
||||
class PlayerStateShiftMessageTest extends Specification {
|
||||
val string_short = hex"BE 68"
|
||||
val string_pos = hex"BE 95 A0 89 13 91 B8 B0 B7 F0" //orig: ... B0 BF F0
|
||||
val string_short = hex"BE 68"
|
||||
val string_pos = hex"BE 95 A0 89 13 91 B8 B0 B7 F0" //orig: ... B0 BF F0
|
||||
val string_posAndVel = hex"BE AE 01 29 CD 59 B9 40 C0 EA D4 00 0F 86 40"
|
||||
|
||||
"decode (short)" in {
|
||||
|
|
@ -73,7 +73,9 @@ class PlayerStateShiftMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (pos and vel)" in {
|
||||
val msg = PlayerStateShiftMessage(ShiftState(2, Vector3(4645.75f, 5811.6016f, 50.3125f), 50.625f, Vector3(2.8125f, -8.0f, 0.375f)))
|
||||
val msg = PlayerStateShiftMessage(
|
||||
ShiftState(2, Vector3(4645.75f, 5811.6016f, 50.3125f), 50.625f, Vector3(2.8125f, -8.0f, 0.375f))
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_posAndVel
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import net.psforever.types.{PlanetSideGUID, Vector3}
|
|||
import scodec.bits._
|
||||
|
||||
class ProjectileStateMessageTest extends Specification {
|
||||
val string = hex"3f 259d c5019 30e4a 9514 c52c9541 d9ba05c2 c5973941 00 f8 ec 02000000"
|
||||
val string = hex"3f 259d c5019 30e4a 9514 c52c9541 d9ba05c2 c5973941 00 f8 ec 02000000"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
|
|
@ -40,7 +40,7 @@ class ProjectileStateMessageTest extends Specification {
|
|||
//pkt mustEqual string
|
||||
val pkt_bits = pkt.toBitVector
|
||||
val str_bits = string.toBitVector
|
||||
pkt_bits.take(184) mustEqual str_bits.take(184) //skip 1 bit
|
||||
pkt_bits.take(184) mustEqual str_bits.take(184) //skip 1 bit
|
||||
pkt_bits.drop(185).take(7) mustEqual str_bits.drop(185).take(7) //skip 1 bit
|
||||
pkt_bits.drop(193) mustEqual str_bits.drop(193)
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -9,18 +9,22 @@ import scodec.bits._
|
|||
|
||||
class ReplicationStreamMessageTest extends Specification {
|
||||
val stringListClear = hex"E6 B9 FE"
|
||||
val stringListOne = hex"E6 B8 01 06 01 00 8B 46007200610067004C0041004E00640049004E004300 84 4600720061006700 0A00 00 00 0A FF"
|
||||
val stringListTwo = hex"E6 B8 01 06 06 00 8E 470065006E006500720061006C0047006F0072006700750074007A00 A1 46004C0059002C0041006C006C002000770065006C0063006F006D0065002C0063006E0020006C0061007300740020006E0069006700680074002100210021002100 0400 00 00 7A 01 83 02 00 45 80 4B004F004B006B006900610073004D00460043004E00 87 5300710075006100640020003200 0400 00 00 6A FF"
|
||||
val stringListThree = hex"E6 B8 01 06 06 00 8E 470065006E006500720061006C0047006F0072006700750074007A00 A1 46004C0059002C0041006C006C002000770065006C0063006F006D0065002C0063006E0020006C0061007300740020006E0069006700680074002100210021002100 0400 00 00 7A 01 83 01 80 4600 4E0049004700480054003800380052004100560045004E00 8B 41006C006C002000570065006C0063006F006D006500 0A 00 00 00 4A 02 83 02 00 45 80 4B004F004B006B006900610073004D00460043004E00 87 5300710075006100640020003200 0400 00 00 6A FF"
|
||||
val stringListRemove = hex"E6 20 A0 19 FE"
|
||||
val stringListOne =
|
||||
hex"E6 B8 01 06 01 00 8B 46007200610067004C0041004E00640049004E004300 84 4600720061006700 0A00 00 00 0A FF"
|
||||
val stringListTwo =
|
||||
hex"E6 B8 01 06 06 00 8E 470065006E006500720061006C0047006F0072006700750074007A00 A1 46004C0059002C0041006C006C002000770065006C0063006F006D0065002C0063006E0020006C0061007300740020006E0069006700680074002100210021002100 0400 00 00 7A 01 83 02 00 45 80 4B004F004B006B006900610073004D00460043004E00 87 5300710075006100640020003200 0400 00 00 6A FF"
|
||||
val stringListThree =
|
||||
hex"E6 B8 01 06 06 00 8E 470065006E006500720061006C0047006F0072006700750074007A00 A1 46004C0059002C0041006C006C002000770065006C0063006F006D0065002C0063006E0020006C0061007300740020006E0069006700680074002100210021002100 0400 00 00 7A 01 83 01 80 4600 4E0049004700480054003800380052004100560045004E00 8B 41006C006C002000570065006C0063006F006D006500 0A 00 00 00 4A 02 83 02 00 45 80 4B004F004B006B006900610073004D00460043004E00 87 5300710075006100640020003200 0400 00 00 6A FF"
|
||||
val stringListRemove = hex"E6 20 A0 19 FE"
|
||||
val stringUpdateLeader = hex"E6 C0 28 08 C4 00 46006100740065004A0048004E004300 FF"
|
||||
val stringUpdateTask = hex"E6 C0 58 094E00 52004900500020005000530031002C0020007600690073006900740020005000530046006F00720065007600650072002E006E0065007400 FF"
|
||||
val stringUpdateContinent = hex"E6 C0 38 09 85000000 7F80"
|
||||
val stringUpdateSize = hex"E6 C0 18 0A 37 F8"
|
||||
val stringUpdateLeaderSize = hex"E6 C0 58 10 C3 00 4A0069006D006D0079006E00 43 FF"
|
||||
val stringUpdateTask =
|
||||
hex"E6 C0 58 094E00 52004900500020005000530031002C0020007600690073006900740020005000530046006F00720065007600650072002E006E0065007400 FF"
|
||||
val stringUpdateContinent = hex"E6 C0 38 09 85000000 7F80"
|
||||
val stringUpdateSize = hex"E6 C0 18 0A 37 F8"
|
||||
val stringUpdateLeaderSize = hex"E6 C0 58 10 C3 00 4A0069006D006D0079006E00 43 FF"
|
||||
val stringUpdateTaskContinent = hex"E6 C0 58 11 40 80 3200 3 04000000 FF0"
|
||||
val stringUpdateAll = hex"E6 C0 78 30 58 0430 6D00610064006D0075006A00 80 040000000A FF"
|
||||
val stringRemoveUpdate = hex"e6 20201801014aff"
|
||||
val stringUpdateAll = hex"E6 C0 78 30 58 0430 6D00610064006D0075006A00 80 040000000A FF"
|
||||
val stringRemoveUpdate = hex"e6 20201801014aff"
|
||||
|
||||
"SquadInfo (w/out squad_guid)" in {
|
||||
val o = SquadInfo("FragLANdINC", "Frag", PlanetSideZoneID(10), 0, 10)
|
||||
|
|
@ -379,7 +383,9 @@ class ReplicationStreamMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (remove)" in {
|
||||
val msg = ReplicationStreamMessage(1, None,
|
||||
val msg = ReplicationStreamMessage(
|
||||
1,
|
||||
None,
|
||||
Vector(
|
||||
SquadListing(5, None)
|
||||
)
|
||||
|
|
@ -390,7 +396,9 @@ class ReplicationStreamMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (update leader)" in {
|
||||
val msg = ReplicationStreamMessage(6, None,
|
||||
val msg = ReplicationStreamMessage(
|
||||
6,
|
||||
None,
|
||||
Vector(
|
||||
SquadListing(2, SquadInfo("FateJHNC"))
|
||||
)
|
||||
|
|
@ -401,7 +409,9 @@ class ReplicationStreamMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (update task)" in {
|
||||
val msg = ReplicationStreamMessage(6, None,
|
||||
val msg = ReplicationStreamMessage(
|
||||
6,
|
||||
None,
|
||||
Vector(
|
||||
SquadListing(5, SquadInfo(None, "RIP PS1, visit PSForever.net"))
|
||||
)
|
||||
|
|
@ -412,7 +422,9 @@ class ReplicationStreamMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (update continent)" in {
|
||||
val msg = ReplicationStreamMessage(6, None,
|
||||
val msg = ReplicationStreamMessage(
|
||||
6,
|
||||
None,
|
||||
Vector(
|
||||
SquadListing(3, SquadInfo(PlanetSideZoneID(10)))
|
||||
)
|
||||
|
|
@ -423,7 +435,9 @@ class ReplicationStreamMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (update size)" in {
|
||||
val msg = ReplicationStreamMessage(6, None,
|
||||
val msg = ReplicationStreamMessage(
|
||||
6,
|
||||
None,
|
||||
Vector(
|
||||
SquadListing(1, SquadInfo(6))
|
||||
)
|
||||
|
|
@ -434,7 +448,9 @@ class ReplicationStreamMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (update leader and size)" in {
|
||||
val msg = ReplicationStreamMessage(6, None,
|
||||
val msg = ReplicationStreamMessage(
|
||||
6,
|
||||
None,
|
||||
Vector(
|
||||
SquadListing(5, SquadInfo("Jimmyn").And(SquadInfo(3)))
|
||||
)
|
||||
|
|
@ -445,7 +461,9 @@ class ReplicationStreamMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (update task and continent)" in {
|
||||
val msg = ReplicationStreamMessage(6, None,
|
||||
val msg = ReplicationStreamMessage(
|
||||
6,
|
||||
None,
|
||||
Vector(
|
||||
SquadListing(5, SquadInfo(None, "2").And(SquadInfo(PlanetSideZoneID(4))))
|
||||
)
|
||||
|
|
@ -456,7 +474,9 @@ class ReplicationStreamMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (update all)" in {
|
||||
val msg = ReplicationStreamMessage(6, None,
|
||||
val msg = ReplicationStreamMessage(
|
||||
6,
|
||||
None,
|
||||
Vector(
|
||||
SquadListing(7, SquadInfo("madmuj", "", PlanetSideZoneID(4), 0, 10, PlanetSideGUID(11)))
|
||||
)
|
||||
|
|
@ -467,7 +487,9 @@ class ReplicationStreamMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (remove 1 and update 0)" in {
|
||||
val msg = ReplicationStreamMessage(1, None,
|
||||
val msg = ReplicationStreamMessage(
|
||||
1,
|
||||
None,
|
||||
Vector(
|
||||
SquadListing(1, None),
|
||||
SquadListing(0, SquadInfo(10))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import net.psforever.packet.game._
|
|||
import scodec.bits._
|
||||
|
||||
class SetChatFilterMessageTest extends Specification {
|
||||
val string = hex"63 05FF80"
|
||||
val string = hex"63 05FF80"
|
||||
val string_custom = hex"63 05C180"
|
||||
|
||||
"decode" in {
|
||||
|
|
@ -46,28 +46,76 @@ class SetChatFilterMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = SetChatFilterMessage(ChatChannel.Local, true, List(ChatChannel.Unknown, ChatChannel.Tells, ChatChannel.Local, ChatChannel.Squad, ChatChannel.Outfit, ChatChannel.Command, ChatChannel.Platoon, ChatChannel.Broadcast, ChatChannel.SquadLeader))
|
||||
val msg = SetChatFilterMessage(
|
||||
ChatChannel.Local,
|
||||
true,
|
||||
List(
|
||||
ChatChannel.Unknown,
|
||||
ChatChannel.Tells,
|
||||
ChatChannel.Local,
|
||||
ChatChannel.Squad,
|
||||
ChatChannel.Outfit,
|
||||
ChatChannel.Command,
|
||||
ChatChannel.Platoon,
|
||||
ChatChannel.Broadcast,
|
||||
ChatChannel.SquadLeader
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
|
||||
"encode (success; same channel listed multiple times)" in {
|
||||
val msg = SetChatFilterMessage(ChatChannel.Local, true, List(ChatChannel.Unknown, ChatChannel.Unknown, ChatChannel.Tells, ChatChannel.Tells, ChatChannel.Local, ChatChannel.Squad, ChatChannel.Outfit, ChatChannel.Command, ChatChannel.Platoon, ChatChannel.Broadcast, ChatChannel.SquadLeader))
|
||||
val msg = SetChatFilterMessage(
|
||||
ChatChannel.Local,
|
||||
true,
|
||||
List(
|
||||
ChatChannel.Unknown,
|
||||
ChatChannel.Unknown,
|
||||
ChatChannel.Tells,
|
||||
ChatChannel.Tells,
|
||||
ChatChannel.Local,
|
||||
ChatChannel.Squad,
|
||||
ChatChannel.Outfit,
|
||||
ChatChannel.Command,
|
||||
ChatChannel.Platoon,
|
||||
ChatChannel.Broadcast,
|
||||
ChatChannel.SquadLeader
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
|
||||
"encode (success; out of order)" in {
|
||||
val msg = SetChatFilterMessage(ChatChannel.Local, true, List(ChatChannel.Squad, ChatChannel.Outfit, ChatChannel.SquadLeader, ChatChannel.Unknown, ChatChannel.Command, ChatChannel.Platoon, ChatChannel.Broadcast, ChatChannel.Tells, ChatChannel.Local))
|
||||
val msg = SetChatFilterMessage(
|
||||
ChatChannel.Local,
|
||||
true,
|
||||
List(
|
||||
ChatChannel.Squad,
|
||||
ChatChannel.Outfit,
|
||||
ChatChannel.SquadLeader,
|
||||
ChatChannel.Unknown,
|
||||
ChatChannel.Command,
|
||||
ChatChannel.Platoon,
|
||||
ChatChannel.Broadcast,
|
||||
ChatChannel.Tells,
|
||||
ChatChannel.Local
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
|
||||
"encode (success; custom)" in {
|
||||
val msg = SetChatFilterMessage(ChatChannel.Local, true, List(ChatChannel.Unknown, ChatChannel.Tells, ChatChannel.Broadcast, ChatChannel.SquadLeader))
|
||||
val msg = SetChatFilterMessage(
|
||||
ChatChannel.Local,
|
||||
true,
|
||||
List(ChatChannel.Unknown, ChatChannel.Tells, ChatChannel.Broadcast, ChatChannel.SquadLeader)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_custom
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class SpawnRequestMessageTest extends Specification {
|
|||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case SpawnRequestMessage(unk1,unk2,unk3,unk4,unk5) =>
|
||||
case SpawnRequestMessage(unk1, unk2, unk3, unk4, unk5) =>
|
||||
unk1 mustEqual 0
|
||||
unk2 mustEqual SpawnGroup.Facility
|
||||
unk3 mustEqual 0
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import net.psforever.types.{PlanetSideGUID, Vector3}
|
|||
import scodec.bits._
|
||||
|
||||
class SplashHitMessageTest extends Specification {
|
||||
val string = hex"62 7129e72b0c1dd1516ec58000051e01d8371f0100000025803616bb2a9ae50b000008889d00644bdd35454c45c000000400"
|
||||
val string =
|
||||
hex"62 7129e72b0c1dd1516ec58000051e01d8371f0100000025803616bb2a9ae50b000008889d00644bdd35454c45c000000400"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
|
|
@ -46,10 +47,15 @@ class SplashHitMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = SplashHitMessage(113, PlanetSideGUID(40103),
|
||||
Vector3(3681.3438f, 2728.9062f, 90.921875f), 0, 0,
|
||||
Some(Vector3(2.21875f, 0.90625f, -1.125f)), None,
|
||||
SplashedTarget(PlanetSideGUID(75), Vector3(3674.8438f, 2726.789f, 91.15625f), 286326784L, None) ::
|
||||
val msg = SplashHitMessage(
|
||||
113,
|
||||
PlanetSideGUID(40103),
|
||||
Vector3(3681.3438f, 2728.9062f, 90.921875f),
|
||||
0,
|
||||
0,
|
||||
Some(Vector3(2.21875f, 0.90625f, -1.125f)),
|
||||
None,
|
||||
SplashedTarget(PlanetSideGUID(75), Vector3(3674.8438f, 2726.789f, 91.15625f), 286326784L, None) ::
|
||||
SplashedTarget(PlanetSideGUID(372), Vector3(3679.1328f, 2722.6016f, 92.765625f), 268435456L, None) ::
|
||||
Nil
|
||||
)
|
||||
|
|
|
|||
|
|
@ -13,29 +13,35 @@ class SquadDefinitionActionMessageTest extends Specification {
|
|||
val string_00 = hex"e7 00 0c0000" //guid: 3
|
||||
val string_03 = hex"E7 0c 0000c0" //index: 3
|
||||
val string_04 = hex"E7 10 0000c0" //index: 3
|
||||
val string_07 = hex"e7 1c 0000e68043006f0070007300200061006e00640020004d0069006c006900740061007200790020004f006600660069006300650072007300"
|
||||
val string_07 =
|
||||
hex"e7 1c 0000e68043006f0070007300200061006e00640020004d0069006c006900740061007200790020004f006600660069006300650072007300"
|
||||
val string_08 = hex"E7 20 000000"
|
||||
val string_10 = hex"E7 28 000004" //index: 1
|
||||
val string_10 = hex"E7 28 000004" //index: 1
|
||||
val string_19 = hex"E7 4c 0000218041002d005400650061006d00" //"A-Team"
|
||||
val string_20 = hex"E7 50 0000004000"
|
||||
val string_21 = hex"E7 54 000008" //index: 2
|
||||
val string_22 = hex"E7 58 000008" //index: 2
|
||||
val string_21 = hex"E7 54 000008" //index: 2
|
||||
val string_22 = hex"E7 58 000008" //index: 2
|
||||
val string_23 = hex"E7 5c 0000061842004c00550046004f005200" //"BLUFOR", index: 1
|
||||
val string_24 = hex"E7 60 000006386b0069006c006c002000620061006400200064007500640065007300" //"kill bad dudes", index: 1
|
||||
val string_24 =
|
||||
hex"E7 60 000006386b0069006c006c002000620061006400200064007500640065007300" //"kill bad dudes", index: 1
|
||||
val string_25 = hex"E7 64 000004400000800000" //"Anti-Vehicular" (former), "Infiltration Suit" (latter), index: 1
|
||||
val string_26 = hex"E7 68 000000"
|
||||
val string_28 = hex"E7 70 000020" //On
|
||||
val string_31 = hex"E7 7c 000020" //On
|
||||
val string_34a = hex"E7 88 00002180420061006400610073007300000000000000040000" //"Badass", Solsar, Any matching position
|
||||
val string_34b = hex"E7 88 00002180420061006400610073007300000000000000080000" //"Badass", Hossin, Any matching position
|
||||
val string_28 = hex"E7 70 000020" //On
|
||||
val string_31 = hex"E7 7c 000020" //On
|
||||
val string_34a =
|
||||
hex"E7 88 00002180420061006400610073007300000000000000040000" //"Badass", Solsar, Any matching position
|
||||
val string_34b =
|
||||
hex"E7 88 00002180420061006400610073007300000000000000080000" //"Badass", Hossin, Any matching position
|
||||
val string_34c = hex"E7 88 00002180420061006400610073007300000000000000080080" //"Badass", Hossin, Any position
|
||||
val string_34d = hex"E7 88 00002180420061006400610073007300100000200000080100" //"Badass", Hossin, Some("Anti-Vehicular", "Infiltration Suit")
|
||||
val string_34e = hex"E7 88 00002180420061006400610073007300100000200000080180" //"Badass", Hossin, All("Anti-Vehicular", "Infiltration Suit")
|
||||
val string_34d =
|
||||
hex"E7 88 00002180420061006400610073007300100000200000080100" //"Badass", Hossin, Some("Anti-Vehicular", "Infiltration Suit")
|
||||
val string_34e =
|
||||
hex"E7 88 00002180420061006400610073007300100000200000080180" //"Badass", Hossin, All("Anti-Vehicular", "Infiltration Suit")
|
||||
val string_35 = hex"E7 8c 000000"
|
||||
val string_40 = hex"E7 a0 000004" //index: 1
|
||||
val string_41 = hex"E7 a4 000000"
|
||||
|
||||
val string_43 = hex"e7 ac 000000"
|
||||
val string_43 = hex"e7 ac 000000"
|
||||
val string_failure = hex"E7 ff"
|
||||
|
||||
"decode (00)" in {
|
||||
|
|
@ -255,7 +261,12 @@ class SquadDefinitionActionMessageTest extends Specification {
|
|||
case SquadDefinitionActionMessage(unk1, unk2, action) =>
|
||||
unk1 mustEqual PlanetSideGUID(0)
|
||||
unk2 mustEqual 0
|
||||
action mustEqual SearchForSquadsWithParticularRole("Badass", Set(CertificationType.InfiltrationSuit, CertificationType.AntiVehicular), 2, SearchMode.SomeCertifications)
|
||||
action mustEqual SearchForSquadsWithParticularRole(
|
||||
"Badass",
|
||||
Set(CertificationType.InfiltrationSuit, CertificationType.AntiVehicular),
|
||||
2,
|
||||
SearchMode.SomeCertifications
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -266,7 +277,12 @@ class SquadDefinitionActionMessageTest extends Specification {
|
|||
case SquadDefinitionActionMessage(unk1, unk2, action) =>
|
||||
unk1 mustEqual PlanetSideGUID(0)
|
||||
unk2 mustEqual 0
|
||||
action mustEqual SearchForSquadsWithParticularRole("Badass", Set(CertificationType.InfiltrationSuit, CertificationType.AntiVehicular), 2, SearchMode.AllCertifications)
|
||||
action mustEqual SearchForSquadsWithParticularRole(
|
||||
"Badass",
|
||||
Set(CertificationType.InfiltrationSuit, CertificationType.AntiVehicular),
|
||||
2,
|
||||
SearchMode.AllCertifications
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -398,17 +414,25 @@ class SquadDefinitionActionMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (24)" in {
|
||||
val msg = SquadDefinitionActionMessage(PlanetSideGUID(0), 0, ChangeSquadMemberRequirementsDetailedOrders(1, "kill bad dudes"))
|
||||
val msg = SquadDefinitionActionMessage(
|
||||
PlanetSideGUID(0),
|
||||
0,
|
||||
ChangeSquadMemberRequirementsDetailedOrders(1, "kill bad dudes")
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_24
|
||||
}
|
||||
|
||||
"encode (25)" in {
|
||||
val msg = SquadDefinitionActionMessage(PlanetSideGUID(0), 0, ChangeSquadMemberRequirementsCertifications(
|
||||
1,
|
||||
Set(CertificationType.AntiVehicular, CertificationType.InfiltrationSuit)
|
||||
))
|
||||
val msg = SquadDefinitionActionMessage(
|
||||
PlanetSideGUID(0),
|
||||
0,
|
||||
ChangeSquadMemberRequirementsCertifications(
|
||||
1,
|
||||
Set(CertificationType.AntiVehicular, CertificationType.InfiltrationSuit)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_25
|
||||
|
|
@ -436,35 +460,65 @@ class SquadDefinitionActionMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (34a)" in {
|
||||
val msg = SquadDefinitionActionMessage(PlanetSideGUID(0), 0, SearchForSquadsWithParticularRole("Badass", Set(), 1, SearchMode.AnyPositions))
|
||||
val msg = SquadDefinitionActionMessage(
|
||||
PlanetSideGUID(0),
|
||||
0,
|
||||
SearchForSquadsWithParticularRole("Badass", Set(), 1, SearchMode.AnyPositions)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_34a
|
||||
}
|
||||
|
||||
"encode (34b)" in {
|
||||
val msg = SquadDefinitionActionMessage(PlanetSideGUID(0), 0, SearchForSquadsWithParticularRole("Badass", Set(), 2, SearchMode.AnyPositions))
|
||||
val msg = SquadDefinitionActionMessage(
|
||||
PlanetSideGUID(0),
|
||||
0,
|
||||
SearchForSquadsWithParticularRole("Badass", Set(), 2, SearchMode.AnyPositions)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_34b
|
||||
}
|
||||
|
||||
"encode (34c)" in {
|
||||
val msg = SquadDefinitionActionMessage(PlanetSideGUID(0), 0, SearchForSquadsWithParticularRole("Badass", Set(), 2, SearchMode.AvailablePositions))
|
||||
val msg = SquadDefinitionActionMessage(
|
||||
PlanetSideGUID(0),
|
||||
0,
|
||||
SearchForSquadsWithParticularRole("Badass", Set(), 2, SearchMode.AvailablePositions)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_34c
|
||||
}
|
||||
|
||||
"encode (34d)" in {
|
||||
val msg = SquadDefinitionActionMessage(PlanetSideGUID(0), 0, SearchForSquadsWithParticularRole("Badass", Set(CertificationType.InfiltrationSuit, CertificationType.AntiVehicular), 2, SearchMode.SomeCertifications))
|
||||
val msg = SquadDefinitionActionMessage(
|
||||
PlanetSideGUID(0),
|
||||
0,
|
||||
SearchForSquadsWithParticularRole(
|
||||
"Badass",
|
||||
Set(CertificationType.InfiltrationSuit, CertificationType.AntiVehicular),
|
||||
2,
|
||||
SearchMode.SomeCertifications
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_34d
|
||||
}
|
||||
|
||||
"encode (34e)" in {
|
||||
val msg = SquadDefinitionActionMessage(PlanetSideGUID(0), 0, SearchForSquadsWithParticularRole("Badass", Set(CertificationType.InfiltrationSuit, CertificationType.AntiVehicular), 2, SearchMode.AllCertifications))
|
||||
val msg = SquadDefinitionActionMessage(
|
||||
PlanetSideGUID(0),
|
||||
0,
|
||||
SearchForSquadsWithParticularRole(
|
||||
"Badass",
|
||||
Set(CertificationType.InfiltrationSuit, CertificationType.AntiVehicular),
|
||||
2,
|
||||
SearchMode.AllCertifications
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_34e
|
||||
|
|
|
|||
|
|
@ -8,20 +8,25 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
||||
val string_unk1 = hex"e80300818800015c5189004603408c000000012000ff"
|
||||
val string_unk1 = hex"e80300818800015c5189004603408c000000012000ff"
|
||||
val string_leader_char_id = hex"e8050080904d56b808"
|
||||
val string_unk3LeaderName = hex"e80300821104145011b9be840024284a00610061006b006f008c008118000000024000ff"
|
||||
val string_task = hex"e8050080ac6041006c006c002000570065006c0063006f006d0065002000"
|
||||
val string_zone = hex"e8030080b0a8000000"
|
||||
val string_taskZone = hex"e80200812ce05c002300460046003000300030003000200054006800650020005c002300660066006600660066006600200042006c0061006400650073006040000000"
|
||||
val string_unk7 = hex"e8030081ac8054006800650020004b0069006e00670027007300200053007100750061006400788c09808c4854006800650020004700750061007200640008808c5054006800650020004b006e00690067006800740007808c4054006800650020004500610072006c0006808c4054006800650020004c006f007200640005808c405400680065002000440075006b00650004808c4854006800650020004200610072006f006e0003808c6054006800650020005000720069006e00630065007300730002808c5054006800650020005000720069006e006300650001808c48540068006500200051007500650065006e0000808c4054006800650020004b0069006e006700ff"
|
||||
val string_member_closed = hex"e8030080c602c043fe"
|
||||
val string_member_role = hex"e8070080c60040462443006f006d006d0061006e00640065007200ff"
|
||||
val string_task = hex"e8050080ac6041006c006c002000570065006c0063006f006d0065002000"
|
||||
val string_zone = hex"e8030080b0a8000000"
|
||||
val string_taskZone =
|
||||
hex"e80200812ce05c002300460046003000300030003000200054006800650020005c002300660066006600660066006600200042006c0061006400650073006040000000"
|
||||
val string_unk7 =
|
||||
hex"e8030081ac8054006800650020004b0069006e00670027007300200053007100750061006400788c09808c4854006800650020004700750061007200640008808c5054006800650020004b006e00690067006800740007808c4054006800650020004500610072006c0006808c4054006800650020004c006f007200640005808c405400680065002000440075006b00650004808c4854006800650020004200610072006f006e0003808c6054006800650020005000720069006e00630065007300730002808c5054006800650020005000720069006e006300650001808c48540068006500200051007500650065006e0000808c4054006800650020004b0069006e006700ff"
|
||||
val string_member_closed = hex"e8030080c602c043fe"
|
||||
val string_member_role = hex"e8070080c60040462443006f006d006d0061006e00640065007200ff"
|
||||
val string_member_roleRequirements = hex"e8010080c60340862841004400560020004800610063006b00650072005000000002003fc0"
|
||||
val string_member_charIdName = hex"e8030080c602c08f2658480123004400750063006b006d006100730074006500720034003300ff"
|
||||
val string_task_memberEtc = hex"e80100812ce05c002300460046003000300030003000200054006800650020005c002300660066006600660066006600200042006c0061006400650073008c09810c005000000000000220230007808c0006808c0005808c0004808c0003808c0002808c0001808c0000808c00ff"
|
||||
val string_full = hex"e80300848180038021514601288a8400420048006f0066004400bf5c0023006600660064006300300030002a002a002a005c0023003900360034003000660066003d004b004f004b002b005300500043002b0046004c0059003d005c0023006600660064006300300030002a002a002a005c002300460046003400300034003000200041006c006c002000570065006c0063006f006d006500070000009814010650005c00230066006600300030003000300020007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c008000000000800100000c00020c8c5c00230066006600640063003000300020002000200043008000000000800100000c00020c8c5c002300660066006400630030003000200020002000480080eab58a02854f0070006f006c0045000100000c00020c8d5c002300660066006400630030003000200020002000200049008072d47a028b42006f006200610046003300740074003900300037000100000c00020c8c5c0023006600660064006300300030002000200020004e008000000000800100000c00020c8c5c00230066006600640063003000300020002000200041008000000000800100000c00020ca05c00230066006600300030003000300020007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c008000000000800100000c00020c8c5c0023003900360034003000660066002000200020004b008000000000800100000c00020c8c5c0023003900360034003000660066002000200020004f008042a28c028448006f00660044000100000c00020c8c5c0023003900360034003000660066002000200020004b008000000000800100000c0000"
|
||||
val string_mixed = hex"e80300812cd85000530046006f007200650076006500720020005000610063006b0065007400200043006f006c006c0065006300740069006f006e00841400000181306400800000000080000000000000220c808000000000800000000000001e0c808000000000800000000000001a0c80800000000080000000000000160c80800000000080000000000000120c808000000000800000000000000e0c808000000000800000000000000a0c80800000000080000000000000060c80800000000080000000000000020c80800000000080000000000003fc"
|
||||
val string_member_charIdName = hex"e8030080c602c08f2658480123004400750063006b006d006100730074006500720034003300ff"
|
||||
val string_task_memberEtc =
|
||||
hex"e80100812ce05c002300460046003000300030003000200054006800650020005c002300660066006600660066006600200042006c0061006400650073008c09810c005000000000000220230007808c0006808c0005808c0004808c0003808c0002808c0001808c0000808c00ff"
|
||||
val string_full =
|
||||
hex"e80300848180038021514601288a8400420048006f0066004400bf5c0023006600660064006300300030002a002a002a005c0023003900360034003000660066003d004b004f004b002b005300500043002b0046004c0059003d005c0023006600660064006300300030002a002a002a005c002300460046003400300034003000200041006c006c002000570065006c0063006f006d006500070000009814010650005c00230066006600300030003000300020007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c008000000000800100000c00020c8c5c00230066006600640063003000300020002000200043008000000000800100000c00020c8c5c002300660066006400630030003000200020002000480080eab58a02854f0070006f006c0045000100000c00020c8d5c002300660066006400630030003000200020002000200049008072d47a028b42006f006200610046003300740074003900300037000100000c00020c8c5c0023006600660064006300300030002000200020004e008000000000800100000c00020c8c5c00230066006600640063003000300020002000200041008000000000800100000c00020ca05c00230066006600300030003000300020007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c007c008000000000800100000c00020c8c5c0023003900360034003000660066002000200020004b008000000000800100000c00020c8c5c0023003900360034003000660066002000200020004f008042a28c028448006f00660044000100000c00020c8c5c0023003900360034003000660066002000200020004b008000000000800100000c0000"
|
||||
val string_mixed =
|
||||
hex"e80300812cd85000530046006f007200650076006500720020005000610063006b0065007400200043006f006c006c0065006300740069006f006e00841400000181306400800000000080000000000000220c808000000000800000000000001e0c808000000000800000000000001a0c80800000000080000000000000160c80800000000080000000000000120c808000000000800000000000000e0c808000000000800000000000000a0c80800000000080000000000000060c80800000000080000000000000020c80800000000080000000000003fc"
|
||||
|
||||
"SquadDetailDefinitionUpdateMessage" should {
|
||||
"decode (unk1 + members)" in {
|
||||
|
|
@ -32,7 +37,7 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
case SquadDetail(Some(unk1), None, Some(char_id), None, None, None, None, None, Some(_)) =>
|
||||
unk1 mustEqual 0
|
||||
char_id mustEqual 1221560L
|
||||
//members tests follow ...
|
||||
//members tests follow ...
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -66,7 +71,7 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
char_id mustEqual 42631712L
|
||||
unk3 mustEqual 556403L
|
||||
leader mustEqual "Jaako"
|
||||
//members tests follow ...
|
||||
//members tests follow ...
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -123,22 +128,22 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
ok
|
||||
}
|
||||
|
||||
"decode (unk7 + members)" in {
|
||||
PacketCoding.DecodePacket(string_unk7).require match {
|
||||
case SquadDetailDefinitionUpdateMessage(guid, detail) =>
|
||||
guid mustEqual PlanetSideGUID(3)
|
||||
detail match {
|
||||
case SquadDetail(None, None, None, None, None, Some(task), None, Some(unk7), Some(_)) =>
|
||||
task mustEqual "The King's Squad"
|
||||
unk7 mustEqual 8
|
||||
//members tests follow ...
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
"decode (unk7 + members)" in {
|
||||
PacketCoding.DecodePacket(string_unk7).require match {
|
||||
case SquadDetailDefinitionUpdateMessage(guid, detail) =>
|
||||
guid mustEqual PlanetSideGUID(3)
|
||||
detail match {
|
||||
case SquadDetail(None, None, None, None, None, Some(task), None, Some(unk7), Some(_)) =>
|
||||
task mustEqual "The King's Squad"
|
||||
unk7 mustEqual 8
|
||||
//members tests follow ...
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"decode (member closed)" in {
|
||||
PacketCoding.DecodePacket(string_member_closed).require match {
|
||||
|
|
@ -276,7 +281,17 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
case SquadDetailDefinitionUpdateMessage(guid, detail) =>
|
||||
guid mustEqual PlanetSideGUID(3)
|
||||
detail match {
|
||||
case SquadDetail(Some(u1), Some(u2), Some(char_id), Some(u3), Some(leader), Some(task), Some(zone), Some(unk7), Some(member_list)) =>
|
||||
case SquadDetail(
|
||||
Some(u1),
|
||||
Some(u2),
|
||||
Some(char_id),
|
||||
Some(u3),
|
||||
Some(leader),
|
||||
Some(task),
|
||||
Some(zone),
|
||||
Some(unk7),
|
||||
Some(member_list)
|
||||
) =>
|
||||
u1 mustEqual 3
|
||||
u2 mustEqual 1792
|
||||
char_id mustEqual 42771010L
|
||||
|
|
@ -286,104 +301,196 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
zone mustEqual PlanetSideZoneID(7)
|
||||
unk7 mustEqual 4983296
|
||||
member_list.size mustEqual 10
|
||||
member_list.head mustEqual SquadPositionEntry(0,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ff0000 |||||||||||||||||||||||"),
|
||||
Some(""),
|
||||
Some(Set(CertificationType.StandardAssault, CertificationType.StandardExoSuit, CertificationType.AgileExoSuit)),
|
||||
Some(0),
|
||||
Some("")))
|
||||
member_list.head mustEqual SquadPositionEntry(
|
||||
0,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ff0000 |||||||||||||||||||||||"),
|
||||
Some(""),
|
||||
Some(
|
||||
Set(
|
||||
CertificationType.StandardAssault,
|
||||
CertificationType.StandardExoSuit,
|
||||
CertificationType.AgileExoSuit
|
||||
)
|
||||
),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
)
|
||||
member_list(1) mustEqual SquadPositionEntry(1,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ffdc00 C"),
|
||||
Some(""),
|
||||
Some(Set(CertificationType.StandardAssault, CertificationType.StandardExoSuit, CertificationType.AgileExoSuit)),
|
||||
Some(0),
|
||||
Some("")))
|
||||
member_list(1) mustEqual SquadPositionEntry(
|
||||
1,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ffdc00 C"),
|
||||
Some(""),
|
||||
Some(
|
||||
Set(
|
||||
CertificationType.StandardAssault,
|
||||
CertificationType.StandardExoSuit,
|
||||
CertificationType.AgileExoSuit
|
||||
)
|
||||
),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
)
|
||||
member_list(2) mustEqual SquadPositionEntry(2,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ffdc00 H"),
|
||||
Some(""),
|
||||
Some(Set(CertificationType.StandardAssault, CertificationType.StandardExoSuit, CertificationType.AgileExoSuit)),
|
||||
Some(42644970L),
|
||||
Some("OpolE")
|
||||
member_list(2) mustEqual SquadPositionEntry(
|
||||
2,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ffdc00 H"),
|
||||
Some(""),
|
||||
Some(
|
||||
Set(
|
||||
CertificationType.StandardAssault,
|
||||
CertificationType.StandardExoSuit,
|
||||
CertificationType.AgileExoSuit
|
||||
)
|
||||
),
|
||||
Some(42644970L),
|
||||
Some("OpolE")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(3) mustEqual SquadPositionEntry(3,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ffdc00 I"),
|
||||
Some(""),
|
||||
Some(Set(CertificationType.StandardAssault, CertificationType.StandardExoSuit, CertificationType.AgileExoSuit)),
|
||||
Some(41604210L),
|
||||
Some("BobaF3tt907")
|
||||
)
|
||||
member_list(3) mustEqual SquadPositionEntry(
|
||||
3,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ffdc00 I"),
|
||||
Some(""),
|
||||
Some(
|
||||
Set(
|
||||
CertificationType.StandardAssault,
|
||||
CertificationType.StandardExoSuit,
|
||||
CertificationType.AgileExoSuit
|
||||
)
|
||||
),
|
||||
Some(41604210L),
|
||||
Some("BobaF3tt907")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(4) mustEqual SquadPositionEntry(4,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ffdc00 N"),
|
||||
Some(""),
|
||||
Some(Set(CertificationType.StandardAssault, CertificationType.StandardExoSuit, CertificationType.AgileExoSuit)),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(4) mustEqual SquadPositionEntry(
|
||||
4,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ffdc00 N"),
|
||||
Some(""),
|
||||
Some(
|
||||
Set(
|
||||
CertificationType.StandardAssault,
|
||||
CertificationType.StandardExoSuit,
|
||||
CertificationType.AgileExoSuit
|
||||
)
|
||||
),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(5) mustEqual SquadPositionEntry(5,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ffdc00 A"),
|
||||
Some(""),
|
||||
Some(Set(CertificationType.StandardAssault, CertificationType.StandardExoSuit, CertificationType.AgileExoSuit)),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(5) mustEqual SquadPositionEntry(
|
||||
5,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ffdc00 A"),
|
||||
Some(""),
|
||||
Some(
|
||||
Set(
|
||||
CertificationType.StandardAssault,
|
||||
CertificationType.StandardExoSuit,
|
||||
CertificationType.AgileExoSuit
|
||||
)
|
||||
),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(6) mustEqual SquadPositionEntry(6,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ff0000 |||||||||||||||||||||||"),
|
||||
Some(""),
|
||||
Some(Set(CertificationType.StandardAssault, CertificationType.StandardExoSuit, CertificationType.AgileExoSuit)),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(6) mustEqual SquadPositionEntry(
|
||||
6,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#ff0000 |||||||||||||||||||||||"),
|
||||
Some(""),
|
||||
Some(
|
||||
Set(
|
||||
CertificationType.StandardAssault,
|
||||
CertificationType.StandardExoSuit,
|
||||
CertificationType.AgileExoSuit
|
||||
)
|
||||
),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(7) mustEqual SquadPositionEntry(7,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#9640ff K"),
|
||||
Some(""),
|
||||
Some(Set(CertificationType.StandardAssault, CertificationType.StandardExoSuit, CertificationType.AgileExoSuit)),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(7) mustEqual SquadPositionEntry(
|
||||
7,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#9640ff K"),
|
||||
Some(""),
|
||||
Some(
|
||||
Set(
|
||||
CertificationType.StandardAssault,
|
||||
CertificationType.StandardExoSuit,
|
||||
CertificationType.AgileExoSuit
|
||||
)
|
||||
),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(8) mustEqual SquadPositionEntry(8,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#9640ff O"),
|
||||
Some(""),
|
||||
Some(Set(CertificationType.StandardAssault, CertificationType.StandardExoSuit, CertificationType.AgileExoSuit)),
|
||||
Some(42771010L),
|
||||
Some("HofD")
|
||||
)
|
||||
member_list(8) mustEqual SquadPositionEntry(
|
||||
8,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#9640ff O"),
|
||||
Some(""),
|
||||
Some(
|
||||
Set(
|
||||
CertificationType.StandardAssault,
|
||||
CertificationType.StandardExoSuit,
|
||||
CertificationType.AgileExoSuit
|
||||
)
|
||||
),
|
||||
Some(42771010L),
|
||||
Some("HofD")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(9) mustEqual SquadPositionEntry(9,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#9640ff K"),
|
||||
Some(""),
|
||||
Some(Set(CertificationType.StandardAssault, CertificationType.StandardExoSuit, CertificationType.AgileExoSuit)),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(9) mustEqual SquadPositionEntry(
|
||||
9,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some("\\#9640ff K"),
|
||||
Some(""),
|
||||
Some(
|
||||
Set(
|
||||
CertificationType.StandardAssault,
|
||||
CertificationType.StandardExoSuit,
|
||||
CertificationType.AgileExoSuit
|
||||
)
|
||||
),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -400,106 +507,136 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
case SquadDetail(None, None, None, None, None, Some(task), None, None, Some(member_list)) =>
|
||||
task mustEqual "PSForever Packet Collection"
|
||||
member_list.size mustEqual 10
|
||||
member_list.head mustEqual SquadPositionEntry(9,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
))
|
||||
member_list.head mustEqual SquadPositionEntry(
|
||||
9,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
)
|
||||
member_list(1) mustEqual SquadPositionEntry(8,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
))
|
||||
member_list(1) mustEqual SquadPositionEntry(
|
||||
8,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
)
|
||||
member_list(2) mustEqual SquadPositionEntry(7,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
member_list(2) mustEqual SquadPositionEntry(
|
||||
7,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(3) mustEqual SquadPositionEntry(6,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(3) mustEqual SquadPositionEntry(
|
||||
6,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(4) mustEqual SquadPositionEntry(5,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(4) mustEqual SquadPositionEntry(
|
||||
5,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(5) mustEqual SquadPositionEntry(4,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(5) mustEqual SquadPositionEntry(
|
||||
4,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(6) mustEqual SquadPositionEntry(3,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(6) mustEqual SquadPositionEntry(
|
||||
3,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(7) mustEqual SquadPositionEntry(2,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(7) mustEqual SquadPositionEntry(
|
||||
2,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(8) mustEqual SquadPositionEntry(1,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(8) mustEqual SquadPositionEntry(
|
||||
1,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
member_list(9) mustEqual SquadPositionEntry(0,Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
member_list(9) mustEqual SquadPositionEntry(
|
||||
0,
|
||||
Some(
|
||||
SquadPositionDetail(
|
||||
Some(false),
|
||||
Some(""),
|
||||
Some(""),
|
||||
Some(Set.empty),
|
||||
Some(0),
|
||||
Some("")
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -515,9 +652,11 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
SquadDetail()
|
||||
.Field1(0)
|
||||
.LeaderCharId(1221560L)
|
||||
.Members(List(
|
||||
SquadPositionEntry(6, SquadPositionDetail().Player(0L, ""))
|
||||
))
|
||||
.Members(
|
||||
List(
|
||||
SquadPositionEntry(6, SquadPositionDetail().Player(0L, ""))
|
||||
)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_unk1
|
||||
|
|
@ -538,9 +677,11 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
SquadDetail()
|
||||
.Leader(42631712L, "Jaako")
|
||||
.Field3(556403L)
|
||||
.Members(List(
|
||||
SquadPositionEntry(0, SquadPositionDetail().Player(0L, ""))
|
||||
))
|
||||
.Members(
|
||||
List(
|
||||
SquadPositionEntry(0, SquadPositionDetail().Player(0L, ""))
|
||||
)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_unk3LeaderName
|
||||
|
|
@ -581,18 +722,20 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
SquadDetail()
|
||||
.Task("The King's Squad")
|
||||
.Field7(8)
|
||||
.Members(List(
|
||||
SquadPositionEntry(9, SquadPositionDetail().Role("The Guard")),
|
||||
SquadPositionEntry(8, SquadPositionDetail().Role("The Knight")),
|
||||
SquadPositionEntry(7, SquadPositionDetail().Role("The Earl")),
|
||||
SquadPositionEntry(6, SquadPositionDetail().Role("The Lord")),
|
||||
SquadPositionEntry(5, SquadPositionDetail().Role("The Duke")),
|
||||
SquadPositionEntry(4, SquadPositionDetail().Role("The Baron")),
|
||||
SquadPositionEntry(3, SquadPositionDetail().Role("The Princess")),
|
||||
SquadPositionEntry(2, SquadPositionDetail().Role("The Prince")),
|
||||
SquadPositionEntry(1, SquadPositionDetail().Role("The Queen")),
|
||||
SquadPositionEntry(0, SquadPositionDetail().Role("The King"))
|
||||
))
|
||||
.Members(
|
||||
List(
|
||||
SquadPositionEntry(9, SquadPositionDetail().Role("The Guard")),
|
||||
SquadPositionEntry(8, SquadPositionDetail().Role("The Knight")),
|
||||
SquadPositionEntry(7, SquadPositionDetail().Role("The Earl")),
|
||||
SquadPositionEntry(6, SquadPositionDetail().Role("The Lord")),
|
||||
SquadPositionEntry(5, SquadPositionDetail().Role("The Duke")),
|
||||
SquadPositionEntry(4, SquadPositionDetail().Role("The Baron")),
|
||||
SquadPositionEntry(3, SquadPositionDetail().Role("The Princess")),
|
||||
SquadPositionEntry(2, SquadPositionDetail().Role("The Prince")),
|
||||
SquadPositionEntry(1, SquadPositionDetail().Role("The Queen")),
|
||||
SquadPositionEntry(0, SquadPositionDetail().Role("The King"))
|
||||
)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_unk7
|
||||
|
|
@ -602,22 +745,25 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
val msg = SquadDetailDefinitionUpdateMessage(
|
||||
PlanetSideGUID(3),
|
||||
SquadDetail()
|
||||
.Members(List(
|
||||
SquadPositionEntry(5, SquadPositionDetail.Closed)
|
||||
))
|
||||
.Members(
|
||||
List(
|
||||
SquadPositionEntry(5, SquadPositionDetail.Closed)
|
||||
)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_member_closed
|
||||
}
|
||||
|
||||
|
||||
"encode (member role)" in {
|
||||
val msg = SquadDetailDefinitionUpdateMessage(
|
||||
PlanetSideGUID(7),
|
||||
SquadDetail()
|
||||
.Members(List(
|
||||
SquadPositionEntry(0, SquadPositionDetail().Role("Commander"))
|
||||
))
|
||||
.Members(
|
||||
List(
|
||||
SquadPositionEntry(0, SquadPositionDetail().Role("Commander"))
|
||||
)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_member_role
|
||||
|
|
@ -627,11 +773,16 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
val msg = SquadDetailDefinitionUpdateMessage(
|
||||
PlanetSideGUID(1),
|
||||
SquadDetail()
|
||||
.Members(List(
|
||||
SquadPositionEntry(6, SquadPositionDetail()
|
||||
.Role("ADV Hacker")
|
||||
.Requirements(Set(CertificationType.AdvancedHacking)))
|
||||
))
|
||||
.Members(
|
||||
List(
|
||||
SquadPositionEntry(
|
||||
6,
|
||||
SquadPositionDetail()
|
||||
.Role("ADV Hacker")
|
||||
.Requirements(Set(CertificationType.AdvancedHacking))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_member_roleRequirements
|
||||
|
|
@ -641,9 +792,11 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
val msg = SquadDetailDefinitionUpdateMessage(
|
||||
PlanetSideGUID(3),
|
||||
SquadDetail()
|
||||
.Members(List(
|
||||
SquadPositionEntry(5, SquadPositionDetail().Player(1218249L, "Duckmaster43"))
|
||||
))
|
||||
.Members(
|
||||
List(
|
||||
SquadPositionEntry(5, SquadPositionDetail().Player(1218249L, "Duckmaster43"))
|
||||
)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_member_charIdName
|
||||
|
|
@ -654,18 +807,20 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
PlanetSideGUID(1),
|
||||
SquadDetail()
|
||||
.Task("\\#FF0000 The \\#ffffff Blades")
|
||||
.Members(List(
|
||||
SquadPositionEntry(9, SquadPositionDetail().Role("").Requirements(Set())),
|
||||
SquadPositionEntry(8, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(7, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(6, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(5, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(4, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(3, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(2, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(1, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(0, SquadPositionDetail().Role(""))
|
||||
))
|
||||
.Members(
|
||||
List(
|
||||
SquadPositionEntry(9, SquadPositionDetail().Role("").Requirements(Set())),
|
||||
SquadPositionEntry(8, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(7, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(6, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(5, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(4, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(3, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(2, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(1, SquadPositionDetail().Role("")),
|
||||
SquadPositionEntry(0, SquadPositionDetail().Role(""))
|
||||
)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_task_memberEtc
|
||||
|
|
@ -692,7 +847,7 @@ class SquadDetailDefinitionUpdateMessageTest extends Specification {
|
|||
SquadPositionEntry(5, SquadPositionDetail("\\#ffdc00 A", "", Set(), 0, "")),
|
||||
SquadPositionEntry(6, SquadPositionDetail("\\#ff0000 |||||||||||||||||||||||", "", Set(), 0, "")),
|
||||
SquadPositionEntry(7, SquadPositionDetail("\\#9640ff K", "", Set(), 0, "")),
|
||||
SquadPositionEntry(8, SquadPositionDetail("\\#9640ff O", "", Set(), 42771010L ,"HofD")),
|
||||
SquadPositionEntry(8, SquadPositionDetail("\\#9640ff O", "", Set(), 42771010L, "HofD")),
|
||||
SquadPositionEntry(9, SquadPositionDetail("\\#9640ff K", "", Set(), 0, ""))
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -307,7 +307,8 @@ class SquadMembershipResponseTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (0-2)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.Invite, 0, 0, 1176612L, Some(1004937L), "SPOILERS", true, None)
|
||||
val msg =
|
||||
SquadMembershipResponse(SquadResponseType.Invite, 0, 0, 1176612L, Some(1004937L), "SPOILERS", true, None)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_02
|
||||
|
|
@ -328,49 +329,96 @@ class SquadMembershipResponseTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (2-1)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.Accept, 0, 0, 1300870L, Some(42771010L), "VirusGiver", true, Some(None))
|
||||
val msg = SquadMembershipResponse(
|
||||
SquadResponseType.Accept,
|
||||
0,
|
||||
0,
|
||||
1300870L,
|
||||
Some(42771010L),
|
||||
"VirusGiver",
|
||||
true,
|
||||
Some(None)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_21
|
||||
}
|
||||
|
||||
"encode (2-2)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.Accept, 0, 0, 1300870L, Some(30736877L), "VirusGiver", true, Some(None))
|
||||
val msg = SquadMembershipResponse(
|
||||
SquadResponseType.Accept,
|
||||
0,
|
||||
0,
|
||||
1300870L,
|
||||
Some(30736877L),
|
||||
"VirusGiver",
|
||||
true,
|
||||
Some(None)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_22
|
||||
}
|
||||
|
||||
"encode (3-1)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.Reject, 0, 3, 31035057L, Some(42771010L), "HMFIC", false, Some(None))
|
||||
val msg =
|
||||
SquadMembershipResponse(SquadResponseType.Reject, 0, 3, 31035057L, Some(42771010L), "HMFIC", false, Some(None))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_31
|
||||
}
|
||||
|
||||
"encode (3-2)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.Reject, 0, 2, 31106913L, Some(42771010L), "DAN1111", false, Some(None))
|
||||
val msg = SquadMembershipResponse(
|
||||
SquadResponseType.Reject,
|
||||
0,
|
||||
2,
|
||||
31106913L,
|
||||
Some(42771010L),
|
||||
"DAN1111",
|
||||
false,
|
||||
Some(None)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_32
|
||||
}
|
||||
|
||||
"encode (4-1)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.Cancel, 0, 2, 41578085L, Some(41607133L), "SAraisVanu", false, Some(None))
|
||||
val msg = SquadMembershipResponse(
|
||||
SquadResponseType.Cancel,
|
||||
0,
|
||||
2,
|
||||
41578085L,
|
||||
Some(41607133L),
|
||||
"SAraisVanu",
|
||||
false,
|
||||
Some(None)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_41
|
||||
}
|
||||
|
||||
"encode (4-2)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.Cancel, 0, 2, 41607396L, Some(41324011L), "AirInjector", false, Some(None))
|
||||
val msg = SquadMembershipResponse(
|
||||
SquadResponseType.Cancel,
|
||||
0,
|
||||
2,
|
||||
41607396L,
|
||||
Some(41324011L),
|
||||
"AirInjector",
|
||||
false,
|
||||
Some(None)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_42
|
||||
}
|
||||
|
||||
"encode (5-1)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.Leave, 0, 1, 1176612L, Some(1176612L), "CCRIDER", true, Some(None))
|
||||
val msg =
|
||||
SquadMembershipResponse(SquadResponseType.Leave, 0, 1, 1176612L, Some(1176612L), "CCRIDER", true, Some(None))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_51
|
||||
|
|
@ -384,35 +432,72 @@ class SquadMembershipResponseTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (7-2)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.PlatoonInvite, 0, 0, 41578085L, Some(30910985L), "Wizkid45", true, Some(None))
|
||||
val msg = SquadMembershipResponse(
|
||||
SquadResponseType.PlatoonInvite,
|
||||
0,
|
||||
0,
|
||||
41578085L,
|
||||
Some(30910985L),
|
||||
"Wizkid45",
|
||||
true,
|
||||
Some(None)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_72
|
||||
}
|
||||
|
||||
"encode (8-1)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.PlatoonAccept, 0, 0, 30910985L, Some(41578085L), "Wizkid45", false, Some(None))
|
||||
val msg = SquadMembershipResponse(
|
||||
SquadResponseType.PlatoonAccept,
|
||||
0,
|
||||
0,
|
||||
30910985L,
|
||||
Some(41578085L),
|
||||
"Wizkid45",
|
||||
false,
|
||||
Some(None)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_81
|
||||
}
|
||||
|
||||
"encode (9-1)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.PlatoonReject, 0, 0, 297025L, Some(41605002L), "", true, Some(None))
|
||||
val msg =
|
||||
SquadMembershipResponse(SquadResponseType.PlatoonReject, 0, 0, 297025L, Some(41605002L), "", true, Some(None))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_91
|
||||
}
|
||||
|
||||
"encode (9-2)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.PlatoonReject, 0, 0, 30910985L, Some(41578085L), "Wizkid45", false, Some(None))
|
||||
val msg = SquadMembershipResponse(
|
||||
SquadResponseType.PlatoonReject,
|
||||
0,
|
||||
0,
|
||||
30910985L,
|
||||
Some(41578085L),
|
||||
"Wizkid45",
|
||||
false,
|
||||
Some(None)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_92
|
||||
}
|
||||
|
||||
"encode (b-1)" in {
|
||||
val msg = SquadMembershipResponse(SquadResponseType.PlatoonLeave, 0, 1, 30910985L, Some(41578085L), "SAraisVanu", false, Some(None))
|
||||
val msg = SquadMembershipResponse(
|
||||
SquadResponseType.PlatoonLeave,
|
||||
0,
|
||||
1,
|
||||
30910985L,
|
||||
Some(41578085L),
|
||||
"SAraisVanu",
|
||||
false,
|
||||
Some(None)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_b1
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ import scodec.bits._
|
|||
class SquadStateTest extends Specification {
|
||||
val string1 = hex"770700186d9130081001b11b27c1c041680000"
|
||||
val string2 = hex"770700242a28c020003e9237a90e3382695004eab58a0281017eb95613df4c42950040"
|
||||
val stringx = hex"7704008dd9ccf010042a9837310e1b82a8c006646c7a028103984f34759c904a800014f01c26f3d014081ddd3896931bc25478037680ea80c081d699a147b01e154000031c0bc81407e08c1a3a890de1542c022070bd0140815958bf29efa6214300108023c01000ae491ac68d1a61342c023623c50140011d6ea0878f3026a00009e014"
|
||||
val stringx =
|
||||
hex"7704008dd9ccf010042a9837310e1b82a8c006646c7a028103984f34759c904a800014f01c26f3d014081ddd3896931bc25478037680ea80c081d699a147b01e154000031c0bc81407e08c1a3a890de1542c022070bd0140815958bf29efa6214300108023c01000ae491ac68d1a61342c023623c50140011d6ea0878f3026a00009e014"
|
||||
|
||||
"decode (1)" in {
|
||||
PacketCoding.DecodePacket(string1).require match {
|
||||
|
|
@ -180,7 +181,7 @@ class SquadStateTest extends Specification {
|
|||
char_id mustEqual 41419792L
|
||||
u2 mustEqual 0
|
||||
u3 mustEqual 5
|
||||
pos mustEqual Vector3(6800.8906f ,4236.7734f, 39.296875f)
|
||||
pos mustEqual Vector3(6800.8906f, 4236.7734f, 39.296875f)
|
||||
u4 mustEqual 2
|
||||
u5 mustEqual 2
|
||||
u6 mustEqual false
|
||||
|
|
@ -211,34 +212,43 @@ class SquadStateTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (1)" in {
|
||||
val msg = SquadState(PlanetSideGUID(7), List(
|
||||
SquadStateInfo(1300870L, 64, 64, Vector3(3464.0469f, 4065.5703f, 20.015625f), 2, 2, false, 0)
|
||||
))
|
||||
val msg = SquadState(
|
||||
PlanetSideGUID(7),
|
||||
List(
|
||||
SquadStateInfo(1300870L, 64, 64, Vector3(3464.0469f, 4065.5703f, 20.015625f), 2, 2, false, 0)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string1
|
||||
}
|
||||
|
||||
"encode (2)" in {
|
||||
val msg = SquadState(PlanetSideGUID(7), List(
|
||||
SquadStateInfo(42771010L, 0, 0, Vector3(6801.953f, 4231.828f, 39.21875f), 2, 2, false, 680),
|
||||
SquadStateInfo(42644970L, 64, 64, Vector3(2908.7422f, 3742.6875f, 67.296875f), 2, 2, false, 680)
|
||||
))
|
||||
val msg = SquadState(
|
||||
PlanetSideGUID(7),
|
||||
List(
|
||||
SquadStateInfo(42771010L, 0, 0, Vector3(6801.953f, 4231.828f, 39.21875f), 2, 2, false, 680),
|
||||
SquadStateInfo(42644970L, 64, 64, Vector3(2908.7422f, 3742.6875f, 67.296875f), 2, 2, false, 680)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string2
|
||||
}
|
||||
|
||||
"encode (8)" in {
|
||||
val msg = SquadState(PlanetSideGUID(4), List(
|
||||
SquadStateInfo(30383325L, 0, 16, Vector3(6849.328f, 4231.5938f, 41.71875f), 2, 2, false, 864),
|
||||
SquadStateInfo(41577572L, 64, 64, Vector3(6183.797f, 4013.6328f, 72.5625f), 2, 2, false, 0, 335, true),
|
||||
SquadStateInfo(41606788L, 64, 64, Vector3(6611.8594f, 4242.586f, 75.46875f), 2, 2, false, 888),
|
||||
SquadStateInfo(30736877L, 64, 64, Vector3(6809.836f, 4218.078f, 40.234375f), 2, 2, false, 0),
|
||||
SquadStateInfo(41517411L, 64, 63, Vector3(6848.0312f, 4232.2266f, 41.734375f), 2, 2, false, 556),
|
||||
SquadStateInfo(41607488L, 64, 64, Vector3(2905.3438f, 3743.9453f, 67.296875f), 2, 2, false, 304),
|
||||
SquadStateInfo(41419792L, 0, 5, Vector3(6800.8906f, 4236.7734f, 39.296875f), 2, 2, false, 556),
|
||||
SquadStateInfo(42616684L, 64, 0, Vector3(2927.1094f, 3704.0312f, 78.375f), 1, 1, false, 0, 572, true)
|
||||
))
|
||||
val msg = SquadState(
|
||||
PlanetSideGUID(4),
|
||||
List(
|
||||
SquadStateInfo(30383325L, 0, 16, Vector3(6849.328f, 4231.5938f, 41.71875f), 2, 2, false, 864),
|
||||
SquadStateInfo(41577572L, 64, 64, Vector3(6183.797f, 4013.6328f, 72.5625f), 2, 2, false, 0, 335, true),
|
||||
SquadStateInfo(41606788L, 64, 64, Vector3(6611.8594f, 4242.586f, 75.46875f), 2, 2, false, 888),
|
||||
SquadStateInfo(30736877L, 64, 64, Vector3(6809.836f, 4218.078f, 40.234375f), 2, 2, false, 0),
|
||||
SquadStateInfo(41517411L, 64, 63, Vector3(6848.0312f, 4232.2266f, 41.734375f), 2, 2, false, 556),
|
||||
SquadStateInfo(41607488L, 64, 64, Vector3(2905.3438f, 3743.9453f, 67.296875f), 2, 2, false, 304),
|
||||
SquadStateInfo(41419792L, 0, 5, Vector3(6800.8906f, 4236.7734f, 39.296875f), 2, 2, false, 556),
|
||||
SquadStateInfo(42616684L, 64, 0, Vector3(2927.1094f, 3704.0312f, 78.375f), 1, 1, false, 0, 572, true)
|
||||
)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual stringx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class SquadWaypointEventTest extends Specification {
|
|||
unk3 mustEqual 41581052L
|
||||
unk4 mustEqual SquadWaypoints.Two
|
||||
unk5.isEmpty mustEqual true
|
||||
unk6.contains( WaypointEvent(10, Vector3(3457.9688f, 5514.4688f, 0.0f), 1) ) mustEqual true
|
||||
unk6.contains(WaypointEvent(10, Vector3(3457.9688f, 5514.4688f, 0.0f), 1)) mustEqual true
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ class SquadWaypointEventTest extends Specification {
|
|||
unk2 mustEqual 3
|
||||
unk3 mustEqual 41581052L
|
||||
unk4 mustEqual SquadWaypoints.Two
|
||||
unk5.contains( 4L ) mustEqual true
|
||||
unk5.contains(4L) mustEqual true
|
||||
unk6.isEmpty mustEqual true
|
||||
case _ =>
|
||||
ko
|
||||
|
|
@ -84,7 +84,12 @@ class SquadWaypointEventTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (3)" in {
|
||||
val msg = SquadWaypointEvent.Add(3, 41581052L, SquadWaypoints.Two, WaypointEvent(10, Vector3(3457.9688f, 5514.4688f, 0.0f), 1))
|
||||
val msg = SquadWaypointEvent.Add(
|
||||
3,
|
||||
41581052L,
|
||||
SquadWaypoints.Two,
|
||||
WaypointEvent(10, Vector3(3457.9688f, 5514.4688f, 0.0f), 1)
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_3
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ import scodec.bits._
|
|||
|
||||
class TargetingImplantRequestTest extends Specification {
|
||||
val string_single = hex"b5 061016"
|
||||
val string_long = hex"b5 41edeb12d4409f0144053f8010541ba91d03df376831b1e26000611041e1107c0209c0"//0510085013d9ffb6720d5b132900003770?
|
||||
val string_long =
|
||||
hex"b5 41edeb12d4409f0144053f8010541ba91d03df376831b1e26000611041e1107c0209c0" //0510085013d9ffb6720d5b132900003770?
|
||||
|
||||
"decode (single)" in {
|
||||
PacketCoding.DecodePacket(string_single).require match {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import scodec.bits._
|
|||
|
||||
class TriggerEffectMessageTest extends Specification {
|
||||
val string_motionalarmsensor = hex"51 970B 82 6F6E FA00C00000"
|
||||
val string_boomer = hex"51 0000 93 737061776E5F6F626A6563745F656666656374 417BB2CB3B4F8E00000000"
|
||||
val string_boomer_explode = hex"51 DF09 8F 6465746F6E6174655F626F6F6D6572 00"
|
||||
val string_boomer = hex"51 0000 93 737061776E5F6F626A6563745F656666656374 417BB2CB3B4F8E00000000"
|
||||
val string_boomer_explode = hex"51 DF09 8F 6465746F6E6174655F626F6F6D6572 00"
|
||||
|
||||
"decode (motion alarm sensor)" in {
|
||||
PacketCoding.DecodePacket(string_motionalarmsensor).require match {
|
||||
|
|
@ -60,7 +60,8 @@ class TriggerEffectMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (boomer)" in {
|
||||
val msg = TriggerEffectMessage("spawn_object_effect", Vector3(3567.0156f, 3278.6953f, 114.484375f), Vector3(0, 0, 90))
|
||||
val msg =
|
||||
TriggerEffectMessage("spawn_object_effect", Vector3(3567.0156f, 3278.6953f, 114.484375f), Vector3(0, 0, 90))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_boomer
|
||||
|
|
@ -73,4 +74,3 @@ class TriggerEffectMessageTest extends Specification {
|
|||
pkt mustEqual string_boomer_explode
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class UseItemMessageTest extends Specification {
|
|||
avatar_guid mustEqual PlanetSideGUID(75)
|
||||
unk1 mustEqual PlanetSideGUID(0)
|
||||
object_guid mustEqual PlanetSideGUID(372)
|
||||
unk2 mustEqual 0xFFFFFFFFL
|
||||
unk2 mustEqual 0xffffffffL
|
||||
unk3 mustEqual false
|
||||
unk4 mustEqual Vector3(5.0f, 0.0f, 0.0f)
|
||||
unk5 mustEqual Vector3(0.0f, 0.0f, 0.0f)
|
||||
|
|
@ -30,7 +30,19 @@ class UseItemMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = UseItemMessage(PlanetSideGUID(75), PlanetSideGUID(0), PlanetSideGUID(372), 0xFFFFFFFFL, false, Vector3(5.0f, 0.0f, 0.0f), Vector3(0.0f, 0.0f, 0.0f), 11, 25, 0, 364)
|
||||
val msg = UseItemMessage(
|
||||
PlanetSideGUID(75),
|
||||
PlanetSideGUID(0),
|
||||
PlanetSideGUID(372),
|
||||
0xffffffffL,
|
||||
false,
|
||||
Vector3(5.0f, 0.0f, 0.0f),
|
||||
Vector3(0.0f, 0.0f, 0.0f),
|
||||
11,
|
||||
25,
|
||||
0,
|
||||
364
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ import scodec.bits._
|
|||
|
||||
class VNLWorldStatusMessageTest extends Specification {
|
||||
// NOTE: the ServerType is encoded as 0x03 here, but the real planetside server will encode it as 0x04
|
||||
val string = hex"0597570065006c0063006f006d006500200074006f00200050006c0061006e00650074005300690064006500210020000186" ++
|
||||
hex"67656d696e69" ++ hex"0100 03 00 01459e2540 3775" ++ bin"01".toByteVector
|
||||
val string =
|
||||
hex"0597570065006c0063006f006d006500200074006f00200050006c0061006e00650074005300690064006500210020000186" ++
|
||||
hex"67656d696e69" ++ hex"0100 03 00 01459e2540 3775" ++ bin"01".toByteVector
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
|
|
@ -27,24 +28,38 @@ class VNLWorldStatusMessageTest extends Specification {
|
|||
world.status mustEqual WorldStatus.Up
|
||||
world.serverType mustEqual ServerType.Released
|
||||
world.connections.length mustEqual 1
|
||||
world.connections {
|
||||
0
|
||||
}.address.getPort mustEqual 30007
|
||||
world.connections {
|
||||
0
|
||||
}.address.getAddress.toString mustEqual "/64.37.158.69"
|
||||
world
|
||||
.connections {
|
||||
0
|
||||
}
|
||||
.address
|
||||
.getPort mustEqual 30007
|
||||
world
|
||||
.connections {
|
||||
0
|
||||
}
|
||||
.address
|
||||
.getAddress
|
||||
.toString mustEqual "/64.37.158.69"
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = VNLWorldStatusMessage("Welcome to PlanetSide! ",
|
||||
Vector(WorldInformation("gemini", WorldStatus.Up, ServerType.Released,
|
||||
Vector(
|
||||
WorldConnectionInfo(new InetSocketAddress(InetAddress.getByName("64.37.158.69"), 30007))
|
||||
), PlanetSideEmpire.NC
|
||||
))
|
||||
val msg = VNLWorldStatusMessage(
|
||||
"Welcome to PlanetSide! ",
|
||||
Vector(
|
||||
WorldInformation(
|
||||
"gemini",
|
||||
WorldStatus.Up,
|
||||
ServerType.Released,
|
||||
Vector(
|
||||
WorldConnectionInfo(new InetSocketAddress(InetAddress.getByName("64.37.158.69"), 30007))
|
||||
),
|
||||
PlanetSideEmpire.NC
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
//0100 04 00 01459e2540377540
|
||||
|
|
@ -55,7 +70,7 @@ class VNLWorldStatusMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode and decode empty messages" in {
|
||||
val string = hex"0584410041004100410000"
|
||||
val string = hex"0584410041004100410000"
|
||||
val empty_msg = VNLWorldStatusMessage("AAAA", Vector())
|
||||
val empty_pkt = PacketCoding.EncodePacket(empty_msg).require.toByteVector
|
||||
|
||||
|
|
@ -71,16 +86,17 @@ class VNLWorldStatusMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode and decode multiple worlds" in {
|
||||
var string = hex"0597570065006c0063006f006d006500200074006f00200050006c0061006e0065007400530069006400650021002000048941424344414243443101000300006240414243444142434432000002020022404142434441424344330000010100a2404142434441424344340500040000c0"
|
||||
var string =
|
||||
hex"0597570065006c0063006f006d006500200074006f00200050006c0061006e0065007400530069006400650021002000048941424344414243443101000300006240414243444142434432000002020022404142434441424344330000010100a2404142434441424344340500040000c0"
|
||||
|
||||
val worlds = Vector(
|
||||
WorldInformation("ABCDABCD1", WorldStatus.Up, ServerType.Released, Vector(), PlanetSideEmpire.NC),
|
||||
WorldInformation("ABCDABCD2", WorldStatus.Down, ServerType.Beta, Vector(), PlanetSideEmpire.TR),
|
||||
WorldInformation("ABCDABCD3", WorldStatus.Locked, ServerType.Development, Vector(), PlanetSideEmpire.VS),
|
||||
WorldInformation("ABCDABCD4", WorldStatus.Full, ServerType.Released_Gemini, Vector(), PlanetSideEmpire.NEUTRAL)
|
||||
WorldInformation("ABCDABCD1", WorldStatus.Up, ServerType.Released, Vector(), PlanetSideEmpire.NC),
|
||||
WorldInformation("ABCDABCD2", WorldStatus.Down, ServerType.Beta, Vector(), PlanetSideEmpire.TR),
|
||||
WorldInformation("ABCDABCD3", WorldStatus.Locked, ServerType.Development, Vector(), PlanetSideEmpire.VS),
|
||||
WorldInformation("ABCDABCD4", WorldStatus.Full, ServerType.ReleasedGemini, Vector(), PlanetSideEmpire.NEUTRAL)
|
||||
)
|
||||
|
||||
val msg = VNLWorldStatusMessage("Welcome to PlanetSide! ", worlds)
|
||||
val msg = VNLWorldStatusMessage("Welcome to PlanetSide! ", worlds)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
@ -91,7 +107,7 @@ class VNLWorldStatusMessageTest extends Specification {
|
|||
|
||||
pkt_worlds.length mustEqual worlds.length
|
||||
|
||||
for (i <- 0 to pkt_worlds.length-1)
|
||||
for (i <- 0 to pkt_worlds.length - 1)
|
||||
pkt_worlds(i) mustEqual worlds(i)
|
||||
|
||||
ok
|
||||
|
|
|
|||
|
|
@ -44,8 +44,11 @@ class VehicleStateMessageTest extends Specification {
|
|||
Vector3(359.29688f, 1.0546875f, 90.35156f),
|
||||
Some(Vector3(0.0f, 0.0f, 0.03125f)),
|
||||
None,
|
||||
0, 0, 15,
|
||||
false, false
|
||||
0,
|
||||
0,
|
||||
15,
|
||||
false,
|
||||
false
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,15 @@ class VehicleSubStateMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = VehicleSubStateMessage(PlanetSideGUID(7385), PlanetSideGUID(3376), Vector3(3465.9575f, 2873.3635f, 91.05253f), Vector3(11.6015625f, 0.0f, 3.515625f), Some(Vector3(-0.40625f, 0.03125f, -0.8125f)), false, None)
|
||||
val msg = VehicleSubStateMessage(
|
||||
PlanetSideGUID(7385),
|
||||
PlanetSideGUID(3376),
|
||||
Vector3(3465.9575f, 2873.3635f, 91.05253f),
|
||||
Vector3(11.6015625f, 0.0f, 3.515625f),
|
||||
Some(Vector3(-0.40625f, 0.03125f, -0.8125f)),
|
||||
false,
|
||||
None
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -12,7 +12,19 @@ class WeaponFireMessageTest extends Specification {
|
|||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case WeaponFireMessage(seq_time, weapon_guid, projectile_guid, shot_origin, unk1, unk2, unk3, unk4, unk5, unk6, unk7) =>
|
||||
case WeaponFireMessage(
|
||||
seq_time,
|
||||
weapon_guid,
|
||||
projectile_guid,
|
||||
shot_origin,
|
||||
unk1,
|
||||
unk2,
|
||||
unk3,
|
||||
unk4,
|
||||
unk5,
|
||||
unk6,
|
||||
unk7
|
||||
) =>
|
||||
seq_time mustEqual 68
|
||||
weapon_guid mustEqual PlanetSideGUID(76)
|
||||
projectile_guid mustEqual PlanetSideGUID(40100)
|
||||
|
|
@ -30,7 +42,19 @@ class WeaponFireMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = WeaponFireMessage(68, PlanetSideGUID(76), PlanetSideGUID(40100), Vector3(3675.4688f, 2726.9922f, 92.921875f), 0, 64294, 1502, 200, 255, 0, None)
|
||||
val msg = WeaponFireMessage(
|
||||
68,
|
||||
PlanetSideGUID(76),
|
||||
PlanetSideGUID(40100),
|
||||
Vector3(3675.4688f, 2726.9922f, 92.921875f),
|
||||
0,
|
||||
64294,
|
||||
1502,
|
||||
200,
|
||||
255,
|
||||
0,
|
||||
None
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import net.psforever.types.Vector3
|
|||
import scodec.bits._
|
||||
|
||||
class WeatherMessageTest extends Specification {
|
||||
val string = hex"9501000000004A0807C0D65B8FBF2427663F178608BE0B000000006CE13E0C390E3F64445CB7BF3E0C2FF23DA46264A3193FBA522E3F597D9A96093F95B99E3D0800096FE53E6CD6523F39198EAF683F9BA0363D01009C35503F9E5F3E3F3C304E46F23EF9668E3E6B56C8277F3FB084F33EB6C10291423FB17F663F00008C077F3E3135D03E320A"
|
||||
val string =
|
||||
hex"9501000000004A0807C0D65B8FBF2427663F178608BE0B000000006CE13E0C390E3F64445CB7BF3E0C2FF23DA46264A3193FBA522E3F597D9A96093F95B99E3D0800096FE53E6CD6523F39198EAF683F9BA0363D01009C35503F9E5F3E3F3C304E46F23EF9668E3E6B56C8277F3FB084F33EB6C10291423FB17F663F00008C077F3E3135D03E320A"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
|
|
@ -90,7 +91,7 @@ class WeatherMessageTest extends Specification {
|
|||
StormInfo(Vector3(0.6001494f, 0.6809498f, 0.0f), 89, 125) ::
|
||||
StormInfo(Vector3(0.53745425f, 0.07750241f, 0.0f), 8, 0) ::
|
||||
StormInfo(Vector3(0.44811276f, 0.8235843f, 0.0f), 57, 25) ::
|
||||
StormInfo(Vector3(0.90892875f, 0.04458676f, 0.0f),1 ,0) ::
|
||||
StormInfo(Vector3(0.90892875f, 0.04458676f, 0.0f), 1, 0) ::
|
||||
StormInfo(Vector3(0.813318f, 0.7436465f, 0.0f), 60, 48) ::
|
||||
StormInfo(Vector3(0.47319263f, 0.27812937f, 0.0f), 107, 86) ::
|
||||
StormInfo(Vector3(0.99670076f, 0.4756217f, 0.0f), 182, 193) ::
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import net.psforever.packet.game._
|
|||
import scodec.bits._
|
||||
|
||||
class ZoneInfoMessageTest extends Specification {
|
||||
val string = hex"C6 0C 00 80 00 00 00 00"
|
||||
val string = hex"C6 0C 00 80 00 00 00 00"
|
||||
val string_cavern = hex"C6 1B 00 1D F9 F3 00 00"
|
||||
|
||||
"decode (normal)" in {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,18 @@ class ZonePopulationUpdateMessageTest extends Specification {
|
|||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case ZonePopulationUpdateMessage(continent_guid, zone_queue, tr_queue, tr_pop, nc_queue, nc_pop, vs_queue, vs_pop, bo_queue, bo_pop) =>
|
||||
case ZonePopulationUpdateMessage(
|
||||
continent_guid,
|
||||
zone_queue,
|
||||
tr_queue,
|
||||
tr_pop,
|
||||
nc_queue,
|
||||
nc_pop,
|
||||
vs_queue,
|
||||
vs_pop,
|
||||
bo_queue,
|
||||
bo_pop
|
||||
) =>
|
||||
continent_guid mustEqual 4
|
||||
zone_queue mustEqual 414
|
||||
tr_queue mustEqual 138
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ class AegisShieldGeneratorDataTest extends Specification {
|
|||
val obj = AegisShieldGeneratorData(
|
||||
CommonFieldDataWithPlacement(
|
||||
PlacementData(Vector3(3571.2266f, 3278.0938f, 114.0f), Vector3(0, 0, 90)),
|
||||
PlanetSideEmpire.VS, 2, PlanetSideGUID(2366)
|
||||
PlanetSideEmpire.VS,
|
||||
2,
|
||||
PlanetSideGUID(2366)
|
||||
),
|
||||
255
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class CaptureFlagDataTest extends Specification {
|
||||
val string_captureflag = hex"17 E5000000 CE8EA10 04A47 B818A FE0E 00 00 0F 24000015000400160B09000" //LLU for Qumu on Amerish
|
||||
val string_captureflag =
|
||||
hex"17 E5000000 CE8EA10 04A47 B818A FE0E 00 00 0F 24000015000400160B09000" //LLU for Qumu on Amerish
|
||||
|
||||
"CaptureFlagData" in {
|
||||
"decode" in {
|
||||
|
|
@ -38,7 +39,14 @@ class CaptureFlagDataTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val obj = CaptureFlagData(PlacementData(3912.0312f, 5169.4375f, 59.96875f, 0f, 0f, 47.8125f), PlanetSideEmpire.NC, 21, 4, 2838, 9)
|
||||
val obj = CaptureFlagData(
|
||||
PlacementData(3912.0312f, 5169.4375f, 59.96875f, 0f, 0f, 47.8125f),
|
||||
PlanetSideEmpire.NC,
|
||||
21,
|
||||
4,
|
||||
2838,
|
||||
9
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.capture_flag, PlanetSideGUID(4330), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_captureflag
|
||||
|
|
|
|||
|
|
@ -9,14 +9,16 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class CharacterDataTest extends Specification {
|
||||
val string = hex"17 73070000 BC8 3E0F 6C2D7 65535 CA16 00 00 09 9741E4F804000000 234530063007200610077006E00790052006F006E006E0069006500 220B7 E67B540404001000000000022B50100 268042006C00610063006B002000420065007200650074002000410072006D006F007500720065006400200043006F00720070007300 1700E0030050040003BC00000234040001A004000 3FFF67A8F A0A5424E0E800000000080952A9C3A03000001081103E040000000A023782F1080C0000016244108200000000808382403A030000014284C3A0C0000000202512F00B80C00000578F80F840000000280838B3C320300000080"
|
||||
val string =
|
||||
hex"17 73070000 BC8 3E0F 6C2D7 65535 CA16 00 00 09 9741E4F804000000 234530063007200610077006E00790052006F006E006E0069006500 220B7 E67B540404001000000000022B50100 268042006C00610063006B002000420065007200650074002000410072006D006F007500720065006400200043006F00720070007300 1700E0030050040003BC00000234040001A004000 3FFF67A8F A0A5424E0E800000000080952A9C3A03000001081103E040000000A023782F1080C0000016244108200000000808382403A030000014284C3A0C0000000202512F00B80C00000578F80F840000000280838B3C320300000080"
|
||||
//string seated was intentionally-produced test data
|
||||
val string_seated =
|
||||
hex"170307000069023c83e0f800000011a0530063007200610077006e00790052006f006e006e0069006500220b700000000000000000000000" ++
|
||||
hex"06800000268042006c00610063006b002000420065007200650074002000410072006d006f007500720065006400200043006f0072007000" ++
|
||||
hex"73001700e0030050040003bc00000234040001a00400020a8fa0a5424e0e800000000080952a9c3a03000001081103e040000000a023782f" ++
|
||||
hex"1080c0000016244108200000000808382403a030000014284c3a0c0000000202512f00b80c00000578f80f840000000280838b3c320300000080"
|
||||
val string_backpack = hex"17 9C030000 BC8 340D F20A9 3956C AF0D 00 00 73 480000 87041006E00670065006C006C006F00 4A148 0000000000000000000000005C54200 24404F0072006900670069006E0061006C00200044006900730074007200690063007400 1740180181E8000000C202000042000000D202000000010A3C00"
|
||||
hex"06800000268042006c00610063006b002000420065007200650074002000410072006d006f007500720065006400200043006f0072007000" ++
|
||||
hex"73001700e0030050040003bc00000234040001a00400020a8fa0a5424e0e800000000080952a9c3a03000001081103e040000000a023782f" ++
|
||||
hex"1080c0000016244108200000000808382403a030000014284c3a0c0000000202512f00b80c00000578f80f840000000280838b3c320300000080"
|
||||
val string_backpack =
|
||||
hex"17 9C030000 BC8 340D F20A9 3956C AF0D 00 00 73 480000 87041006E00670065006C006C006F00 4A148 0000000000000000000000005C54200 24404F0072006900670069006E0061006C00200044006900730074007200690063007400 1740180181E8000000C202000042000000D202000000010A3C00"
|
||||
|
||||
"CharacterData" should {
|
||||
"decode" in {
|
||||
|
|
@ -88,8 +90,13 @@ class CharacterDataTest extends Specification {
|
|||
char.implant_effects.length mustEqual 1
|
||||
char.implant_effects.head mustEqual ImplantEffects.NoEffects
|
||||
char.cosmetics match {
|
||||
case Some(c : Cosmetics) =>
|
||||
c.Styles mustEqual Set(PersonalStyle.NoHelmet, PersonalStyle.Beret, PersonalStyle.Sunglasses, PersonalStyle.Earpiece)
|
||||
case Some(c: Cosmetics) =>
|
||||
c.Styles mustEqual Set(
|
||||
PersonalStyle.NoHelmet,
|
||||
PersonalStyle.Beret,
|
||||
PersonalStyle.Sunglasses,
|
||||
PersonalStyle.Earpiece
|
||||
)
|
||||
case None =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -196,7 +203,7 @@ class CharacterDataTest extends Specification {
|
|||
ribbons.middle mustEqual MeritCommendation.HeavyInfantry4
|
||||
ribbons.lower mustEqual MeritCommendation.TankBuster7
|
||||
ribbons.tos mustEqual MeritCommendation.SixYearTR
|
||||
//etc..
|
||||
//etc..
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -276,8 +283,13 @@ class CharacterDataTest extends Specification {
|
|||
char.command_rank mustEqual 2
|
||||
char.implant_effects.isEmpty mustEqual true
|
||||
char.cosmetics match {
|
||||
case Some(c : Cosmetics) =>
|
||||
c.Styles mustEqual Set(PersonalStyle.NoHelmet, PersonalStyle.Beret, PersonalStyle.Sunglasses, PersonalStyle.Earpiece)
|
||||
case Some(c: Cosmetics) =>
|
||||
c.Styles mustEqual Set(
|
||||
PersonalStyle.NoHelmet,
|
||||
PersonalStyle.Beret,
|
||||
PersonalStyle.Sunglasses,
|
||||
PersonalStyle.Earpiece
|
||||
)
|
||||
case None =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -293,12 +305,12 @@ class CharacterDataTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val pos : PlacementData = PlacementData(
|
||||
val pos: PlacementData = PlacementData(
|
||||
Vector3(3674.8438f, 2726.789f, 91.15625f),
|
||||
Vector3(0f, 0f, 64.6875f),
|
||||
Some(Vector3(1.4375f, -0.4375f, 0f))
|
||||
)
|
||||
val a : Int=>CharacterAppearanceA = CharacterAppearanceA(
|
||||
val a: Int => CharacterAppearanceA = CharacterAppearanceA(
|
||||
BasicCharacterData(
|
||||
"ScrawnyRonnie",
|
||||
PlanetSideEmpire.TR,
|
||||
|
|
@ -325,7 +337,7 @@ class CharacterDataTest extends Specification {
|
|||
0,
|
||||
0
|
||||
)
|
||||
val b : (Boolean,Int)=>CharacterAppearanceB = CharacterAppearanceB(
|
||||
val b: (Boolean, Int) => CharacterAppearanceB = CharacterAppearanceB(
|
||||
316554L,
|
||||
"Black Beret Armoured Corps",
|
||||
23,
|
||||
|
|
@ -334,7 +346,8 @@ class CharacterDataTest extends Specification {
|
|||
false,
|
||||
false,
|
||||
false,
|
||||
-39.375f, 0f,
|
||||
-39.375f,
|
||||
0f,
|
||||
false,
|
||||
GrenadeState.None,
|
||||
false,
|
||||
|
|
@ -345,8 +358,9 @@ class CharacterDataTest extends Specification {
|
|||
None
|
||||
)
|
||||
|
||||
val app : Int=>CharacterAppearanceData = CharacterAppearanceData(
|
||||
a, b,
|
||||
val app: Int => CharacterAppearanceData = CharacterAppearanceData(
|
||||
a,
|
||||
b,
|
||||
RibbonBars(
|
||||
MeritCommendation.MarkovVeteran,
|
||||
MeritCommendation.HeavyInfantry4,
|
||||
|
|
@ -354,8 +368,9 @@ class CharacterDataTest extends Specification {
|
|||
MeritCommendation.SixYearTR
|
||||
)
|
||||
)
|
||||
val char : (Boolean,Boolean)=>CharacterData = CharacterData(
|
||||
255, 253,
|
||||
val char: (Boolean, Boolean) => CharacterData = CharacterData(
|
||||
255,
|
||||
253,
|
||||
UniformStyle.ThirdUpgrade,
|
||||
7,
|
||||
5,
|
||||
|
|
@ -363,11 +378,36 @@ class CharacterDataTest extends Specification {
|
|||
Some(Cosmetics(true, true, true, true, false))
|
||||
)
|
||||
val inv = InventoryData(
|
||||
InventoryItemData(ObjectClass.plasma_grenade, PlanetSideGUID(3662), 0, WeaponData(0, 0, ObjectClass.plasma_grenade_ammo, PlanetSideGUID(3751), 0, CommonFieldData()(false))) ::
|
||||
InventoryItemData(ObjectClass.bank, PlanetSideGUID(3908), 1, WeaponData(0, 0, 1, ObjectClass.armor_canister, PlanetSideGUID(4143), 0, CommonFieldData()(false))) ::
|
||||
InventoryItemData(ObjectClass.mini_chaingun, PlanetSideGUID(4164), 2, WeaponData(0, 0, ObjectClass.bullet_9mm, PlanetSideGUID(3728), 0, CommonFieldData()(false))) ::
|
||||
InventoryItemData(ObjectClass.phoenix, PlanetSideGUID(3603), 3, WeaponData(0, 0, ObjectClass.phoenix_missile, PlanetSideGUID(3056), 0, CommonFieldData()(false))) ::
|
||||
InventoryItemData(ObjectClass.chainblade, PlanetSideGUID(4088), 4, WeaponData(0, 0, 1, ObjectClass.melee_ammo, PlanetSideGUID(3279), 0, CommonFieldData()(false))) ::
|
||||
InventoryItemData(
|
||||
ObjectClass.plasma_grenade,
|
||||
PlanetSideGUID(3662),
|
||||
0,
|
||||
WeaponData(0, 0, ObjectClass.plasma_grenade_ammo, PlanetSideGUID(3751), 0, CommonFieldData()(false))
|
||||
) ::
|
||||
InventoryItemData(
|
||||
ObjectClass.bank,
|
||||
PlanetSideGUID(3908),
|
||||
1,
|
||||
WeaponData(0, 0, 1, ObjectClass.armor_canister, PlanetSideGUID(4143), 0, CommonFieldData()(false))
|
||||
) ::
|
||||
InventoryItemData(
|
||||
ObjectClass.mini_chaingun,
|
||||
PlanetSideGUID(4164),
|
||||
2,
|
||||
WeaponData(0, 0, ObjectClass.bullet_9mm, PlanetSideGUID(3728), 0, CommonFieldData()(false))
|
||||
) ::
|
||||
InventoryItemData(
|
||||
ObjectClass.phoenix,
|
||||
PlanetSideGUID(3603),
|
||||
3,
|
||||
WeaponData(0, 0, ObjectClass.phoenix_missile, PlanetSideGUID(3056), 0, CommonFieldData()(false))
|
||||
) ::
|
||||
InventoryItemData(
|
||||
ObjectClass.chainblade,
|
||||
PlanetSideGUID(4088),
|
||||
4,
|
||||
WeaponData(0, 0, 1, ObjectClass.melee_ammo, PlanetSideGUID(3279), 0, CommonFieldData()(false))
|
||||
) ::
|
||||
Nil
|
||||
)
|
||||
val obj = PlayerData(pos, app, char, inv, DrawnSlot.Rifle1)
|
||||
|
|
@ -378,7 +418,7 @@ class CharacterDataTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (seated)" in {
|
||||
val a : Int=>CharacterAppearanceA = CharacterAppearanceA(
|
||||
val a: Int => CharacterAppearanceA = CharacterAppearanceA(
|
||||
BasicCharacterData(
|
||||
"ScrawnyRonnie",
|
||||
PlanetSideEmpire.TR,
|
||||
|
|
@ -405,7 +445,7 @@ class CharacterDataTest extends Specification {
|
|||
0,
|
||||
0
|
||||
)
|
||||
val b : (Boolean,Int)=>CharacterAppearanceB = CharacterAppearanceB(
|
||||
val b: (Boolean, Int) => CharacterAppearanceB = CharacterAppearanceB(
|
||||
26L,
|
||||
"Black Beret Armoured Corps",
|
||||
23,
|
||||
|
|
@ -414,7 +454,8 @@ class CharacterDataTest extends Specification {
|
|||
false,
|
||||
false,
|
||||
false,
|
||||
-39.375f, 0f,
|
||||
-39.375f,
|
||||
0f,
|
||||
false,
|
||||
GrenadeState.None,
|
||||
false,
|
||||
|
|
@ -425,8 +466,9 @@ class CharacterDataTest extends Specification {
|
|||
None
|
||||
)
|
||||
|
||||
val app : Int=>CharacterAppearanceData = CharacterAppearanceData(
|
||||
a, b,
|
||||
val app: Int => CharacterAppearanceData = CharacterAppearanceData(
|
||||
a,
|
||||
b,
|
||||
RibbonBars(
|
||||
MeritCommendation.MarkovVeteran,
|
||||
MeritCommendation.HeavyInfantry4,
|
||||
|
|
@ -434,24 +476,55 @@ class CharacterDataTest extends Specification {
|
|||
MeritCommendation.SixYearTR
|
||||
)
|
||||
)
|
||||
val char : (Boolean,Boolean)=>CharacterData = CharacterData(
|
||||
255, 253,
|
||||
val char: (Boolean, Boolean) => CharacterData = CharacterData(
|
||||
255,
|
||||
253,
|
||||
UniformStyle.ThirdUpgrade,
|
||||
5,
|
||||
List(ImplantEffects.NoEffects),
|
||||
Some(Cosmetics(true, true, true, true, false))
|
||||
)
|
||||
val inv = InventoryData(
|
||||
InventoryItemData(ObjectClass.plasma_grenade, PlanetSideGUID(3662), 0, WeaponData(0, 0, ObjectClass.plasma_grenade_ammo, PlanetSideGUID(3751), 0, CommonFieldData()(false))) ::
|
||||
InventoryItemData(ObjectClass.bank, PlanetSideGUID(3908), 1, WeaponData(0, 0, 1, ObjectClass.armor_canister, PlanetSideGUID(4143), 0, CommonFieldData()(false))) ::
|
||||
InventoryItemData(ObjectClass.mini_chaingun, PlanetSideGUID(4164), 2, WeaponData(0, 0, ObjectClass.bullet_9mm, PlanetSideGUID(3728), 0, CommonFieldData()(false))) ::
|
||||
InventoryItemData(ObjectClass.phoenix, PlanetSideGUID(3603), 3, WeaponData(0, 0, ObjectClass.phoenix_missile, PlanetSideGUID(3056), 0, CommonFieldData()(false))) ::
|
||||
InventoryItemData(ObjectClass.chainblade, PlanetSideGUID(4088), 4, WeaponData(0, 0, 1, ObjectClass.melee_ammo, PlanetSideGUID(3279), 0, CommonFieldData()(false))) ::
|
||||
InventoryItemData(
|
||||
ObjectClass.plasma_grenade,
|
||||
PlanetSideGUID(3662),
|
||||
0,
|
||||
WeaponData(0, 0, ObjectClass.plasma_grenade_ammo, PlanetSideGUID(3751), 0, CommonFieldData()(false))
|
||||
) ::
|
||||
InventoryItemData(
|
||||
ObjectClass.bank,
|
||||
PlanetSideGUID(3908),
|
||||
1,
|
||||
WeaponData(0, 0, 1, ObjectClass.armor_canister, PlanetSideGUID(4143), 0, CommonFieldData()(false))
|
||||
) ::
|
||||
InventoryItemData(
|
||||
ObjectClass.mini_chaingun,
|
||||
PlanetSideGUID(4164),
|
||||
2,
|
||||
WeaponData(0, 0, ObjectClass.bullet_9mm, PlanetSideGUID(3728), 0, CommonFieldData()(false))
|
||||
) ::
|
||||
InventoryItemData(
|
||||
ObjectClass.phoenix,
|
||||
PlanetSideGUID(3603),
|
||||
3,
|
||||
WeaponData(0, 0, ObjectClass.phoenix_missile, PlanetSideGUID(3056), 0, CommonFieldData()(false))
|
||||
) ::
|
||||
InventoryItemData(
|
||||
ObjectClass.chainblade,
|
||||
PlanetSideGUID(4088),
|
||||
4,
|
||||
WeaponData(0, 0, 1, ObjectClass.melee_ammo, PlanetSideGUID(3279), 0, CommonFieldData()(false))
|
||||
) ::
|
||||
Nil
|
||||
)
|
||||
val obj = PlayerData(app, char, inv, DrawnSlot.Rifle1)
|
||||
|
||||
val msg = ObjectCreateMessage(ObjectClass.avatar, PlanetSideGUID(3902), ObjectCreateMessageParent(PlanetSideGUID(1234), 0), obj)
|
||||
val msg = ObjectCreateMessage(
|
||||
ObjectClass.avatar,
|
||||
PlanetSideGUID(3902),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(1234), 0),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_seated
|
||||
}
|
||||
|
|
@ -461,7 +534,7 @@ class CharacterDataTest extends Specification {
|
|||
Vector3(4629.8906f, 6316.4453f, 54.734375f),
|
||||
Vector3(0, 0, 126.5625f)
|
||||
)
|
||||
val a : Int=>CharacterAppearanceA = CharacterAppearanceA(
|
||||
val a: Int => CharacterAppearanceA = CharacterAppearanceA(
|
||||
BasicCharacterData(
|
||||
"Angello",
|
||||
PlanetSideEmpire.VS,
|
||||
|
|
@ -488,16 +561,17 @@ class CharacterDataTest extends Specification {
|
|||
0,
|
||||
0
|
||||
)
|
||||
val b : (Boolean,Int)=>CharacterAppearanceB = CharacterAppearanceB(
|
||||
val b: (Boolean, Int) => CharacterAppearanceB = CharacterAppearanceB(
|
||||
529687L,
|
||||
"Original District",
|
||||
23,
|
||||
false, //unk1
|
||||
true, //backpack
|
||||
true, //backpack
|
||||
false, //unk2
|
||||
false, //unk3
|
||||
false, //unk4
|
||||
351.5625f, 0f, //also: -8.4375f, 0f
|
||||
351.5625f,
|
||||
0f, //also: -8.4375f, 0f
|
||||
false, //lfs
|
||||
GrenadeState.None,
|
||||
false, //is_cloaking
|
||||
|
|
@ -508,8 +582,9 @@ class CharacterDataTest extends Specification {
|
|||
None
|
||||
)
|
||||
|
||||
val app : Int=>CharacterAppearanceData = CharacterAppearanceData(
|
||||
a, b,
|
||||
val app: Int => CharacterAppearanceData = CharacterAppearanceData(
|
||||
a,
|
||||
b,
|
||||
RibbonBars(
|
||||
MeritCommendation.Jacking2,
|
||||
MeritCommendation.ScavengerVS1,
|
||||
|
|
@ -517,8 +592,9 @@ class CharacterDataTest extends Specification {
|
|||
MeritCommendation.SixYearVS
|
||||
)
|
||||
)
|
||||
val char : (Boolean,Boolean)=>CharacterData = CharacterData(
|
||||
0, 0,
|
||||
val char: (Boolean, Boolean) => CharacterData = CharacterData(
|
||||
0,
|
||||
0,
|
||||
UniformStyle.ThirdUpgrade,
|
||||
1,
|
||||
List(),
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import scodec.bits._
|
|||
|
||||
object CommonFieldDataTest extends Specification {
|
||||
val string_shotgunshell_dropped = hex"17 A5000000 F9A7D0D 5E269 BED5A F114 0000596000000"
|
||||
val string_implant_interface = hex"17 6C000000 01014C93304818000000"
|
||||
val string_order_terminala = hex"17 A5000000 B2AF30EACF1889F7A3D1200007D2000000"
|
||||
val string_implant_interface = hex"17 6C000000 01014C93304818000000"
|
||||
val string_order_terminala = hex"17 A5000000 B2AF30EACF1889F7A3D1200007D2000000"
|
||||
|
||||
"AmmoBoxData" should {
|
||||
"decode (shotgun shells, dropped)" in {
|
||||
|
|
@ -59,7 +59,6 @@ object CommonFieldDataTest extends Specification {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
"TerminalData" should {
|
||||
"decode (implant interface)" in {
|
||||
PacketCoding.DecodePacket(string_implant_interface).require match {
|
||||
|
|
@ -116,7 +115,12 @@ object CommonFieldDataTest extends Specification {
|
|||
}
|
||||
|
||||
"InternalSlot" in {
|
||||
TerminalData(ObjectClass.order_terminala, PlanetSideGUID(1), 1, CommonFieldData(PlanetSideEmpire.NC)(false)) mustEqual
|
||||
TerminalData(
|
||||
ObjectClass.order_terminala,
|
||||
PlanetSideGUID(1),
|
||||
1,
|
||||
CommonFieldData(PlanetSideEmpire.NC)(false)
|
||||
) mustEqual
|
||||
InternalSlot(ObjectClass.order_terminala, PlanetSideGUID(1), 1, CommonFieldData(PlanetSideEmpire.NC)(false))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class HandheldDataTest extends Specification {
|
||||
val string_ace_held = hex"17 76000000 0406900650C80480000000"
|
||||
val string_ace_held = hex"17 76000000 0406900650C80480000000"
|
||||
val string_ace_dropped = hex"17 AF000000 90024113B329C5D5A2D1200005B440000000"
|
||||
|
||||
"ACE" should {
|
||||
|
|
@ -50,7 +50,10 @@ class HandheldDataTest extends Specification {
|
|||
parent.isDefined mustEqual false
|
||||
data.isInstanceOf[DroppedItemData[_]] mustEqual true
|
||||
data match {
|
||||
case DroppedItemData(pos, HandheldData(CommonFieldData(faction, bops, alternate, v1, v2, v3, v4, v5, fguid), mode, unk)) =>
|
||||
case DroppedItemData(
|
||||
pos,
|
||||
HandheldData(CommonFieldData(faction, bops, alternate, v1, v2, v3, v4, v5, fguid), mode, unk)
|
||||
) =>
|
||||
pos.coord mustEqual Vector3(4708.461f, 5547.539f, 72.703125f)
|
||||
pos.orient mustEqual Vector3.z(194.0625f)
|
||||
|
||||
|
|
@ -72,8 +75,15 @@ class HandheldDataTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (held)" in {
|
||||
val obj = HandheldData(CommonFieldData(PlanetSideEmpire.NC, false, false, true, None, false, None, None, PlanetSideGUID(0)))
|
||||
val msg = ObjectCreateMessage(ObjectClass.ace, PlanetSideGUID(3173), ObjectCreateMessageParent(PlanetSideGUID(3336), 0), obj)
|
||||
val obj = HandheldData(
|
||||
CommonFieldData(PlanetSideEmpire.NC, false, false, true, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
val msg = ObjectCreateMessage(
|
||||
ObjectClass.ace,
|
||||
PlanetSideGUID(3173),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(3336), 0),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_ace_held
|
||||
}
|
||||
|
|
@ -81,7 +91,9 @@ class HandheldDataTest extends Specification {
|
|||
"encode (dropped)" in {
|
||||
val obj = DroppedItemData(
|
||||
PlacementData(4708.461f, 5547.539f, 72.703125f, 0f, 0f, 194.0625f),
|
||||
HandheldData(CommonFieldData(PlanetSideEmpire.VS, false, false, true, None, false, None, None, PlanetSideGUID(0)))
|
||||
HandheldData(
|
||||
CommonFieldData(PlanetSideEmpire.VS, false, false, true, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.ace, PlanetSideGUID(4388), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
|
@ -121,8 +133,15 @@ class HandheldDataTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val obj = HandheldData(CommonFieldData(PlanetSideEmpire.TR, false, false, false, None, false, None, Some(385), PlanetSideGUID(0)))
|
||||
val msg = ObjectCreateMessage(ObjectClass.router_telepad, PlanetSideGUID(418), ObjectCreateMessageParent(PlanetSideGUID(430), 0), obj)
|
||||
val obj = HandheldData(
|
||||
CommonFieldData(PlanetSideEmpire.TR, false, false, false, None, false, None, Some(385), PlanetSideGUID(0))
|
||||
)
|
||||
val msg = ObjectCreateMessage(
|
||||
ObjectClass.router_telepad,
|
||||
PlanetSideGUID(418),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(430), 0),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_telepad
|
||||
|
|
@ -161,14 +180,21 @@ class HandheldDataTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val obj = HandheldData(CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, false, None, false, None, None, PlanetSideGUID(0)))
|
||||
val msg = ObjectCreateMessage(ObjectClass.boomer_trigger, PlanetSideGUID(3600), ObjectCreateMessageParent(PlanetSideGUID(4272), 0), obj)
|
||||
val obj = HandheldData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, false, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
val msg = ObjectCreateMessage(
|
||||
ObjectClass.boomer_trigger,
|
||||
PlanetSideGUID(3600),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(4272), 0),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_boomertrigger
|
||||
}
|
||||
}
|
||||
|
||||
val string_detonater_held = hex"17 76000000 1A886A8421080400000000"
|
||||
val string_detonater_held = hex"17 76000000 1A886A8421080400000000"
|
||||
val string_detonater_dropped = hex"17 AF000000 EA8620ED1549B4B6A741500001B000000000"
|
||||
|
||||
"Command Detonater" should {
|
||||
|
|
@ -208,7 +234,10 @@ class HandheldDataTest extends Specification {
|
|||
guid mustEqual PlanetSideGUID(3682)
|
||||
parent.isDefined mustEqual false
|
||||
data match {
|
||||
case DroppedItemData(pos, HandheldData(CommonFieldData(faction, bops, alternate, v1, v2, v3, v4, v5, fguid), mode, unk)) =>
|
||||
case DroppedItemData(
|
||||
pos,
|
||||
HandheldData(CommonFieldData(faction, bops, alternate, v1, v2, v3, v4, v5, fguid), mode, unk)
|
||||
) =>
|
||||
pos.coord mustEqual Vector3(4777.633f, 5485.4062f, 85.8125f)
|
||||
pos.orient mustEqual Vector3.z(14.0625f)
|
||||
|
||||
|
|
@ -230,8 +259,15 @@ class HandheldDataTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (held)" in {
|
||||
val obj = HandheldData(CommonFieldData(PlanetSideEmpire.NC, false, false, false, None, false, None, None, PlanetSideGUID(0)))
|
||||
val msg = ObjectCreateMessage(ObjectClass.command_detonater, PlanetSideGUID(4162), ObjectCreateMessageParent(PlanetSideGUID(4149), 0), obj)
|
||||
val obj = HandheldData(
|
||||
CommonFieldData(PlanetSideEmpire.NC, false, false, false, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
val msg = ObjectCreateMessage(
|
||||
ObjectClass.command_detonater,
|
||||
PlanetSideGUID(4162),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(4149), 0),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_detonater_held
|
||||
}
|
||||
|
|
@ -239,7 +275,9 @@ class HandheldDataTest extends Specification {
|
|||
"encode (dropped)" in {
|
||||
val obj = DroppedItemData(
|
||||
PlacementData(4777.633f, 5485.4062f, 85.8125f, 0f, 0f, 14.0625f),
|
||||
HandheldData(CommonFieldData(PlanetSideEmpire.TR, false, false, false, None, false, None, None, PlanetSideGUID(0)))
|
||||
HandheldData(
|
||||
CommonFieldData(PlanetSideEmpire.TR, false, false, false, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.command_detonater, PlanetSideGUID(3682), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class LockerContainerDataTest extends Specification {
|
||||
val string_locker_container = hex"17 AF010000 E414C0C00000000000000000000600000818829DC2E030000000202378620D80C00000378FA0FADC000006F1FC199D800000"
|
||||
val string_locker_container =
|
||||
hex"17 AF010000 E414C0C00000000000000000000600000818829DC2E030000000202378620D80C00000378FA0FADC000006F1FC199D800000"
|
||||
|
||||
"LockerContainerData" should {
|
||||
"decode" in {
|
||||
|
|
@ -63,17 +64,32 @@ class LockerContainerDataTest extends Specification {
|
|||
|
||||
"encode" in {
|
||||
val obj = LockerContainerData(
|
||||
InventoryData(List(
|
||||
InventoryItemData(ObjectClass.nano_dispenser, PlanetSideGUID(2935), 0,
|
||||
WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, false, None, false, None, None, PlanetSideGUID(0)),
|
||||
InventoryData(
|
||||
List(
|
||||
InventoryItemData(
|
||||
ObjectClass.nano_dispenser,
|
||||
PlanetSideGUID(2935),
|
||||
0,
|
||||
List(InternalSlot(ObjectClass.armor_canister, PlanetSideGUID(3426), 0, CommonFieldData()(false)))
|
||||
)
|
||||
),
|
||||
InventoryItemData(ObjectClass.armor_canister, PlanetSideGUID(4090), 45, CommonFieldData()(false)),
|
||||
InventoryItemData(ObjectClass.armor_canister, PlanetSideGUID(3326), 78, CommonFieldData()(false))
|
||||
))
|
||||
WeaponData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
),
|
||||
0,
|
||||
List(InternalSlot(ObjectClass.armor_canister, PlanetSideGUID(3426), 0, CommonFieldData()(false)))
|
||||
)
|
||||
),
|
||||
InventoryItemData(ObjectClass.armor_canister, PlanetSideGUID(4090), 45, CommonFieldData()(false)),
|
||||
InventoryItemData(ObjectClass.armor_canister, PlanetSideGUID(3326), 78, CommonFieldData()(false))
|
||||
)
|
||||
)
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.locker_container, PlanetSideGUID(3148), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class OneMannedFieldTurretDataTest extends Specification {
|
||||
val string_orion = hex"17 5E010000 D82640B 92F76 01D65 F611 00 00 5E 4400006304BFC1E4041826E1503900000010104CE704C06400000"
|
||||
val string_orion =
|
||||
hex"17 5E010000 D82640B 92F76 01D65 F611 00 00 5E 4400006304BFC1E4041826E1503900000010104CE704C06400000"
|
||||
|
||||
"OneMannedFieldTurretData" should {
|
||||
"decode (orion)" in {
|
||||
|
|
@ -20,7 +21,11 @@ class OneMannedFieldTurretDataTest extends Specification {
|
|||
guid mustEqual PlanetSideGUID(2916)
|
||||
parent.isDefined mustEqual false
|
||||
data match {
|
||||
case OneMannedFieldTurretData(CommonFieldDataWithPlacement(pos, deploy), health, Some(InventoryData(inv))) =>
|
||||
case OneMannedFieldTurretData(
|
||||
CommonFieldDataWithPlacement(pos, deploy),
|
||||
health,
|
||||
Some(InventoryData(inv))
|
||||
) =>
|
||||
pos.coord mustEqual Vector3(3567.1406f, 2988.0078f, 71.84375f)
|
||||
pos.orient mustEqual Vector3.z(185.625f)
|
||||
deploy.faction mustEqual PlanetSideEmpire.VS
|
||||
|
|
@ -39,7 +44,12 @@ class OneMannedFieldTurretDataTest extends Specification {
|
|||
inv.head.guid mustEqual PlanetSideGUID(2615)
|
||||
inv.head.parentSlot mustEqual 1
|
||||
inv.head.obj match {
|
||||
case WeaponData(CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid), fmode, List(ammo), _) =>
|
||||
case WeaponData(
|
||||
CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid),
|
||||
fmode,
|
||||
List(ammo),
|
||||
_
|
||||
) =>
|
||||
wfaction mustEqual PlanetSideEmpire.NEUTRAL
|
||||
wbops mustEqual false
|
||||
walternate mustEqual false
|
||||
|
|
@ -87,17 +97,47 @@ class OneMannedFieldTurretDataTest extends Specification {
|
|||
CommonFieldData(PlanetSideEmpire.VS, false, false, true, None, false, Some(false), None, PlanetSideGUID(2502))
|
||||
),
|
||||
255,
|
||||
InventoryData(List(
|
||||
InternalSlot(ObjectClass.energy_gun_vs, PlanetSideGUID(2615), 1,
|
||||
WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0)),
|
||||
0,
|
||||
List(InternalSlot(ObjectClass.energy_gun_ammo, PlanetSideGUID(2510), 0,
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, Some(false), None, PlanetSideGUID(0)))
|
||||
InventoryData(
|
||||
List(
|
||||
InternalSlot(
|
||||
ObjectClass.energy_gun_vs,
|
||||
PlanetSideGUID(2615),
|
||||
1,
|
||||
WeaponData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
),
|
||||
0,
|
||||
List(
|
||||
InternalSlot(
|
||||
ObjectClass.energy_gun_ammo,
|
||||
PlanetSideGUID(2510),
|
||||
0,
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
Some(false),
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.portable_manned_turret_vs, PlanetSideGUID(2916), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class REKDataTest extends Specification {
|
||||
val string_rek_held = hex"17 86000000 27086C2350F800800000000000"
|
||||
val string_rek_held = hex"17 86000000 27086C2350F800800000000000"
|
||||
val string_rek_dropped = hex"17 BF000000 EC20311 85219 7AC1A 2D12 00 00 4E 4000000001800"
|
||||
|
||||
"REKData" should {
|
||||
|
|
@ -51,7 +51,10 @@ class REKDataTest extends Specification {
|
|||
guid mustEqual PlanetSideGUID(4355)
|
||||
parent.isDefined mustEqual false
|
||||
data match {
|
||||
case DroppedItemData(pos, REKData(CommonFieldData(faction, bops, alternate, v1, v2, v3, v4, v5, fguid), unk1, unk2)) =>
|
||||
case DroppedItemData(
|
||||
pos,
|
||||
REKData(CommonFieldData(faction, bops, alternate, v1, v2, v3, v4, v5, fguid), unk1, unk2)
|
||||
) =>
|
||||
pos.coord mustEqual Vector3(4675.039f, 5506.953f, 72.703125f)
|
||||
pos.orient mustEqual Vector3.z(230.625f)
|
||||
|
||||
|
|
@ -76,8 +79,15 @@ class REKDataTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (held)" in {
|
||||
val obj = REKData(CommonFieldData(PlanetSideEmpire.TR, false, false, true, None, false, Some(false), None, PlanetSideGUID(0)))
|
||||
val msg = ObjectCreateMessage(ObjectClass.remote_electronics_kit, PlanetSideGUID(3893), ObjectCreateMessageParent(PlanetSideGUID(4174), 0), obj)
|
||||
val obj = REKData(
|
||||
CommonFieldData(PlanetSideEmpire.TR, false, false, true, None, false, Some(false), None, PlanetSideGUID(0))
|
||||
)
|
||||
val msg = ObjectCreateMessage(
|
||||
ObjectClass.remote_electronics_kit,
|
||||
PlanetSideGUID(3893),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(4174), 0),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_rek_held
|
||||
}
|
||||
|
|
@ -85,7 +95,11 @@ class REKDataTest extends Specification {
|
|||
"encode (dropped)" in {
|
||||
val obj = DroppedItemData(
|
||||
PlacementData(4675.039f, 5506.953f, 72.703125f, 0f, 0f, 230.625f),
|
||||
REKData(CommonFieldData(PlanetSideEmpire.VS, false, false, false, None, false, Some(false), None, PlanetSideGUID(0)), 3, 0)
|
||||
REKData(
|
||||
CommonFieldData(PlanetSideEmpire.VS, false, false, false, None, false, Some(false), None, PlanetSideGUID(0)),
|
||||
3,
|
||||
0
|
||||
)
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.remote_electronics_kit, PlanetSideGUID(4355), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class RemoteProjectileDataTest extends Specification {
|
||||
val string_striker_projectile = hex"17 C5000000 A4B 009D 4C129 0CB0A 9814 00 F5 E3 040000666686400"
|
||||
val string_striker_projectile = hex"17 C5000000 A4B 009D 4C129 0CB0A 9814 00 F5 E3 040000666686400"
|
||||
val string_hunter_seeker_missile_projectile = hex"17 c5000000 ca9 ab9e af127 ec465 3723 00 15 c4 2400009a99c9400"
|
||||
|
||||
"RemoteProjectileData" should {
|
||||
|
|
@ -87,7 +87,11 @@ class RemoteProjectileDataTest extends Specification {
|
|||
PlacementData(4644.5938f, 5472.0938f, 82.375f, 0f, 30.9375f, 171.5625f),
|
||||
CommonFieldData(PlanetSideEmpire.TR, false, false, true, None, false, None, None, PlanetSideGUID(0))
|
||||
),
|
||||
26214, 134, FlightPhysics.State4, 0, 0
|
||||
26214,
|
||||
134,
|
||||
FlightPhysics.State4,
|
||||
0,
|
||||
0
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.striker_missile_targeting_projectile, PlanetSideGUID(40192), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
|
@ -105,7 +109,11 @@ class RemoteProjectileDataTest extends Specification {
|
|||
PlacementData(3621.3672f, 2701.8438f, 140.85938f, 0, 300.9375f, 258.75f),
|
||||
CommonFieldData(PlanetSideEmpire.NC, false, false, true, None, false, None, None, PlanetSideGUID(0))
|
||||
),
|
||||
39577, 201, FlightPhysics.State4, 0, 0
|
||||
39577,
|
||||
201,
|
||||
FlightPhysics.State4,
|
||||
0,
|
||||
0
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.hunter_seeker_missile_projectile, PlanetSideGUID(40619), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ import scodec.bits._
|
|||
|
||||
class SmallTurretDataTest extends Specification {
|
||||
val string_spitfire_short = hex"17 BB000000 9D37010 E4F08 6AFCA 0312 00 7F 42 2C1F0F0000F00"
|
||||
val string_spitfire = hex"17 4F010000 9D3A910 D1D78 AE3FC 9111 00 00 69 4488107F80F2021DBF80B80C80000008086EDB83A03200000"
|
||||
val string_spitfire =
|
||||
hex"17 4F010000 9D3A910 D1D78 AE3FC 9111 00 00 69 4488107F80F2021DBF80B80C80000008086EDB83A03200000"
|
||||
|
||||
"SmallTurretData" should {
|
||||
"decode (spitfire, short)" in {
|
||||
|
|
@ -73,7 +74,12 @@ class SmallTurretDataTest extends Specification {
|
|||
inv.head.parentSlot mustEqual 0
|
||||
inv.head.obj.isInstanceOf[WeaponData] mustEqual true
|
||||
inv.head.obj match {
|
||||
case WeaponData(CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid), fmode, List(ammo), _) =>
|
||||
case WeaponData(
|
||||
CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid),
|
||||
fmode,
|
||||
List(ammo),
|
||||
_
|
||||
) =>
|
||||
wfaction mustEqual PlanetSideEmpire.NEUTRAL
|
||||
wbops mustEqual false
|
||||
walternate mustEqual false
|
||||
|
|
@ -134,18 +140,48 @@ class SmallTurretDataTest extends Specification {
|
|||
CommonFieldData(PlanetSideEmpire.VS, false, false, true, None, false, Some(true), None, PlanetSideGUID(8208))
|
||||
),
|
||||
255,
|
||||
InventoryData(List(
|
||||
InternalSlot(ObjectClass.spitfire_weapon, PlanetSideGUID(3064), 0,
|
||||
WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0)),
|
||||
InventoryData(
|
||||
List(
|
||||
InternalSlot(
|
||||
ObjectClass.spitfire_weapon,
|
||||
PlanetSideGUID(3064),
|
||||
0,
|
||||
List(InternalSlot(ObjectClass.spitfire_ammo, PlanetSideGUID(3694), 0,
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, Some(false), None, PlanetSideGUID(0))
|
||||
))
|
||||
WeaponData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
),
|
||||
0,
|
||||
List(
|
||||
InternalSlot(
|
||||
ObjectClass.spitfire_ammo,
|
||||
PlanetSideGUID(3694),
|
||||
0,
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
Some(false),
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
//SmallTurretData.spitfire(PlanetSideGUID(3064), 0x6, 0x8, PlanetSideGUID(3694), 8)
|
||||
)
|
||||
//SmallTurretData.spitfire(PlanetSideGUID(3064), 0x6, 0x8, PlanetSideGUID(3694), 8)
|
||||
))
|
||||
)
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.spitfire_turret, PlanetSideGUID(4265), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ class TRAPDataTest extends Specification {
|
|||
),
|
||||
255
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.tank_traps, PlanetSideGUID(2659), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
val msg = ObjectCreateMessage(ObjectClass.tank_traps, PlanetSideGUID(2659), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
val pkt_bitv = pkt.toBitVector
|
||||
val ori_bitv = string_trap.toBitVector
|
||||
pkt_bitv.take(173) mustEqual ori_bitv.take(173)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,11 @@ class TelepadDeployableDataTest extends Specification {
|
|||
pos.vel.isDefined mustEqual false
|
||||
|
||||
telepad match {
|
||||
case TelepadDeployableData(CommonFieldData(faction, bops, alternate, v1, v2, v3, v4, v5, fguid), u1, u2) =>
|
||||
case TelepadDeployableData(
|
||||
CommonFieldData(faction, bops, alternate, v1, v2, v3, v4, v5, fguid),
|
||||
u1,
|
||||
u2
|
||||
) =>
|
||||
faction mustEqual PlanetSideEmpire.TR
|
||||
bops mustEqual false
|
||||
alternate mustEqual false
|
||||
|
|
@ -69,7 +73,8 @@ class TelepadDeployableDataTest extends Specification {
|
|||
Some(385),
|
||||
PlanetSideGUID(430)
|
||||
),
|
||||
87, 12
|
||||
87,
|
||||
12
|
||||
)
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.router_telepad_deployable, PlanetSideGUID(353), obj)
|
||||
|
|
|
|||
|
|
@ -9,10 +9,11 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class WeaponDataTest extends Specification {
|
||||
val string_lasher_held = hex"17 BB000000 1688569D90B83 880000008082077036032000000"
|
||||
val string_punisher_held = hex"17 F6000000 0A06612331083 88000000810381383E03200003793287C0E400000"
|
||||
val string_lasher_held = hex"17 BB000000 1688569D90B83 880000008082077036032000000"
|
||||
val string_punisher_held = hex"17 F6000000 0A06612331083 88000000810381383E03200003793287C0E400000"
|
||||
val string_lasher_dropped = hex"17 F4000000 D69020C 99299 85D0A 5F10 00 00 20 400000004041038819018000000"
|
||||
val string_punisher_dropped = hex"17 2F010000 E12A20B 915A9 28C9A 1412 00 00 33 200000004081C1901B01800001BCB5C2E07000000"
|
||||
val string_punisher_dropped =
|
||||
hex"17 2F010000 E12A20B 915A9 28C9A 1412 00 00 33 200000004081C1901B01800001BCB5C2E07000000"
|
||||
|
||||
"WeaponData" should {
|
||||
"decode (lasher, held)" in {
|
||||
|
|
@ -25,7 +26,12 @@ class WeaponDataTest extends Specification {
|
|||
parent.get.guid mustEqual PlanetSideGUID(4141)
|
||||
parent.get.slot mustEqual 3
|
||||
data match {
|
||||
case WeaponData(CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid), fmode, List(ammo), _) =>
|
||||
case WeaponData(
|
||||
CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid),
|
||||
fmode,
|
||||
List(ammo),
|
||||
_
|
||||
) =>
|
||||
wfaction mustEqual PlanetSideEmpire.VS
|
||||
wbops mustEqual false
|
||||
walternate mustEqual false
|
||||
|
|
@ -73,7 +79,12 @@ class WeaponDataTest extends Specification {
|
|||
parent.get.guid mustEqual PlanetSideGUID(3092)
|
||||
parent.get.slot mustEqual 3
|
||||
data match {
|
||||
case WeaponData(CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid), fmode, ammo, _) =>
|
||||
case WeaponData(
|
||||
CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid),
|
||||
fmode,
|
||||
ammo,
|
||||
_
|
||||
) =>
|
||||
wfaction mustEqual PlanetSideEmpire.VS
|
||||
wbops mustEqual false
|
||||
walternate mustEqual false
|
||||
|
|
@ -146,7 +157,12 @@ class WeaponDataTest extends Specification {
|
|||
drop.pos.orient.y mustEqual 0f
|
||||
drop.pos.orient.z mustEqual 0f
|
||||
drop.obj match {
|
||||
case WeaponData(CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid), fmode, List(ammo), _) =>
|
||||
case WeaponData(
|
||||
CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid),
|
||||
fmode,
|
||||
List(ammo),
|
||||
_
|
||||
) =>
|
||||
wfaction mustEqual PlanetSideEmpire.VS
|
||||
wbops mustEqual false
|
||||
walternate mustEqual false
|
||||
|
|
@ -200,7 +216,12 @@ class WeaponDataTest extends Specification {
|
|||
drop.pos.orient.y mustEqual 0f
|
||||
drop.pos.orient.z mustEqual 306.5625f
|
||||
drop.obj match {
|
||||
case WeaponData(CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid), fmode, ammo, _) =>
|
||||
case WeaponData(
|
||||
CommonFieldData(wfaction, wbops, walternate, wv1, wv2, wv3, wv4, wv5, wfguid),
|
||||
fmode,
|
||||
ammo,
|
||||
_
|
||||
) =>
|
||||
wfaction mustEqual PlanetSideEmpire.NC
|
||||
wbops mustEqual false
|
||||
walternate mustEqual false
|
||||
|
|
@ -261,9 +282,21 @@ class WeaponDataTest extends Specification {
|
|||
val obj = WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.VS, false, false, true, None, false, None, None, PlanetSideGUID(0)),
|
||||
0,
|
||||
List(InternalSlot(ObjectClass.energy_cell, PlanetSideGUID(3548), 0, CommonFieldData(PlanetSideEmpire.NEUTRAL, 2)(false)))
|
||||
List(
|
||||
InternalSlot(
|
||||
ObjectClass.energy_cell,
|
||||
PlanetSideGUID(3548),
|
||||
0,
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, 2)(false)
|
||||
)
|
||||
)
|
||||
)
|
||||
val msg = ObjectCreateMessage(
|
||||
ObjectClass.lasher,
|
||||
PlanetSideGUID(3033),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(4141), 3),
|
||||
obj
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.lasher, PlanetSideGUID(3033), ObjectCreateMessageParent(PlanetSideGUID(4141), 3), obj)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_lasher_held
|
||||
}
|
||||
|
|
@ -274,11 +307,26 @@ class WeaponDataTest extends Specification {
|
|||
CommonFieldData(PlanetSideEmpire.VS, false, false, true, None, false, None, None, PlanetSideGUID(0)),
|
||||
0,
|
||||
List(
|
||||
AmmoBoxData(ObjectClass.bullet_9mm, PlanetSideGUID(3918), 0, CommonFieldData(PlanetSideEmpire.NEUTRAL, 2)(false)),
|
||||
AmmoBoxData(ObjectClass.rocket, PlanetSideGUID(3941), 1, CommonFieldData(PlanetSideEmpire.NEUTRAL, 2)(false))
|
||||
AmmoBoxData(
|
||||
ObjectClass.bullet_9mm,
|
||||
PlanetSideGUID(3918),
|
||||
0,
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, 2)(false)
|
||||
),
|
||||
AmmoBoxData(
|
||||
ObjectClass.rocket,
|
||||
PlanetSideGUID(3941),
|
||||
1,
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, 2)(false)
|
||||
)
|
||||
)
|
||||
)
|
||||
val msg = ObjectCreateMessage(ObjectClass.punisher, PlanetSideGUID(4147), ObjectCreateMessageParent(PlanetSideGUID(3092), 3), obj)
|
||||
val msg = ObjectCreateMessage(
|
||||
ObjectClass.punisher,
|
||||
PlanetSideGUID(4147),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(3092), 3),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_punisher_held
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,12 @@ class DetailedAmmoBoxDataTest extends Specification {
|
|||
|
||||
"encode (9mm)" in {
|
||||
val obj = DetailedAmmoBoxData(8, 50)
|
||||
val msg = ObjectCreateDetailedMessage(ObjectClass.bullet_9mm, PlanetSideGUID(1280), ObjectCreateMessageParent(PlanetSideGUID(75), 33), obj)
|
||||
val msg = ObjectCreateDetailedMessage(
|
||||
ObjectClass.bullet_9mm,
|
||||
PlanetSideGUID(1280),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(75), 33),
|
||||
obj
|
||||
)
|
||||
val out = PacketCoding.EncodePacket(msg)
|
||||
val pkt = out.require.toByteVector
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -43,8 +43,15 @@ class DetailedCommandDetonaterDataTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val obj = DetailedCommandDetonaterData(CommonFieldData(PlanetSideEmpire.VS, false, false, false, None, false, None, None, PlanetSideGUID(0)))
|
||||
val msg = ObjectCreateDetailedMessage(ObjectClass.command_detonater, PlanetSideGUID(8308), ObjectCreateMessageParent(PlanetSideGUID(3530), 0), obj)
|
||||
val obj = DetailedCommandDetonaterData(
|
||||
CommonFieldData(PlanetSideEmpire.VS, false, false, false, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
val msg = ObjectCreateDetailedMessage(
|
||||
ObjectClass.command_detonater,
|
||||
PlanetSideGUID(8308),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(3530), 0),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual string_detonater
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ import org.specs2.mutable._
|
|||
import scodec.bits._
|
||||
|
||||
class DetailedConstructionToolDataTest extends Specification {
|
||||
val string_ace = hex"18 87000000 1006 100 C70B 80 8800000200008"
|
||||
val string_ace = hex"18 87000000 1006 100 C70B 80 8800000200008"
|
||||
val string_boomer_trigger = hex"18 87000000 6304CA8760B 80 C800000200008"
|
||||
val string_telepad = hex"18 97000000 4f00 f3a e301 80 4a680400000200008"
|
||||
val string_telepad_short = hex"18 87000000 2a00 f3a 5d01 89 8000000200008"
|
||||
val string_telepad = hex"18 97000000 4f00 f3a e301 80 4a680400000200008"
|
||||
val string_telepad_short = hex"18 87000000 2a00 f3a 5d01 89 8000000200008"
|
||||
|
||||
"ACE (detailed)" should {
|
||||
"decode" in {
|
||||
|
|
@ -47,7 +47,12 @@ class DetailedConstructionToolDataTest extends Specification {
|
|||
val obj = DetailedConstructionToolData(
|
||||
CommonFieldData(PlanetSideEmpire.VS, false, false, true, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
val msg = ObjectCreateDetailedMessage(ObjectClass.ace, PlanetSideGUID(3015), ObjectCreateMessageParent(PlanetSideGUID(3104), 0), obj)
|
||||
val msg = ObjectCreateDetailedMessage(
|
||||
ObjectClass.ace,
|
||||
PlanetSideGUID(3015),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(3104), 0),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_ace
|
||||
|
|
@ -87,7 +92,12 @@ class DetailedConstructionToolDataTest extends Specification {
|
|||
val obj = DetailedConstructionToolData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
val msg = ObjectCreateDetailedMessage(ObjectClass.boomer_trigger, PlanetSideGUID(2934), ObjectCreateMessageParent(PlanetSideGUID(2502), 0), obj)
|
||||
val msg = ObjectCreateDetailedMessage(
|
||||
ObjectClass.boomer_trigger,
|
||||
PlanetSideGUID(2934),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(2502), 0),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_boomer_trigger
|
||||
|
|
@ -155,7 +165,12 @@ class DetailedConstructionToolDataTest extends Specification {
|
|||
val obj = DetailedConstructionToolData(
|
||||
CommonFieldData(PlanetSideEmpire.NC, false, false, true, None, false, None, Some(564), PlanetSideGUID(0))
|
||||
)
|
||||
val msg = ObjectCreateDetailedMessage(ObjectClass.router_telepad, PlanetSideGUID(483), ObjectCreateMessageParent(PlanetSideGUID(414), 0), obj)
|
||||
val msg = ObjectCreateDetailedMessage(
|
||||
ObjectClass.router_telepad,
|
||||
PlanetSideGUID(483),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(414), 0),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_telepad
|
||||
|
|
@ -163,7 +178,12 @@ class DetailedConstructionToolDataTest extends Specification {
|
|||
|
||||
"encode (short)" in {
|
||||
val obj = DetailedConstructionToolData(CommonFieldData(PlanetSideEmpire.VS))
|
||||
val msg = ObjectCreateDetailedMessage(ObjectClass.router_telepad, PlanetSideGUID(349), ObjectCreateMessageParent(PlanetSideGUID(340), 9), obj)
|
||||
val msg = ObjectCreateDetailedMessage(
|
||||
ObjectClass.router_telepad,
|
||||
PlanetSideGUID(349),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(340), 9),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_telepad_short
|
||||
|
|
|
|||
|
|
@ -42,8 +42,15 @@ class DetailedREKDataTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val obj = DetailedREKData(CommonFieldData(PlanetSideEmpire.NC, false, false, true, None, false, Some(false), None, PlanetSideGUID(0)))
|
||||
val msg = ObjectCreateDetailedMessage(ObjectClass.remote_electronics_kit, PlanetSideGUID(1439), ObjectCreateMessageParent(PlanetSideGUID(75), 1), obj)
|
||||
val obj = DetailedREKData(
|
||||
CommonFieldData(PlanetSideEmpire.NC, false, false, true, None, false, Some(false), None, PlanetSideGUID(0))
|
||||
)
|
||||
val msg = ObjectCreateDetailedMessage(
|
||||
ObjectClass.remote_electronics_kit,
|
||||
PlanetSideGUID(1439),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(75), 1),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_rek
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import net.psforever.types.{PlanetSideEmpire, PlanetSideGUID}
|
|||
import scodec.bits._
|
||||
|
||||
class DetailedWeaponDataTest extends Specification {
|
||||
val string_gauss = hex"18 DC000000 2580 2C9 B905 82 480000020000C04 1C00C0B0190000078000"
|
||||
val string_gauss = hex"18 DC000000 2580 2C9 B905 82 480000020000C04 1C00C0B0190000078000"
|
||||
val string_punisher = hex"18 27010000 2580 612 a706 82 080000020000c08 1c13a0d01900000780 13a4701a072000000800"
|
||||
|
||||
"DetailedWeaponData" should {
|
||||
|
|
@ -105,7 +105,12 @@ class DetailedWeaponDataTest extends Specification {
|
|||
0,
|
||||
List(InternalSlot(ObjectClass.bullet_9mm, PlanetSideGUID(1286), 0, DetailedAmmoBoxData(8, 30)))
|
||||
)
|
||||
val msg = ObjectCreateDetailedMessage(ObjectClass.gauss, PlanetSideGUID(1465), ObjectCreateMessageParent(PlanetSideGUID(75), 2), obj)
|
||||
val msg = ObjectCreateDetailedMessage(
|
||||
ObjectClass.gauss,
|
||||
PlanetSideGUID(1465),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(75), 2),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_gauss
|
||||
|
|
@ -130,7 +135,12 @@ class DetailedWeaponDataTest extends Specification {
|
|||
DetailedAmmoBoxData(ObjectClass.jammer_cartridge, PlanetSideGUID(1564), 1, DetailedAmmoBoxData(8, 1))
|
||||
)
|
||||
)
|
||||
val msg = ObjectCreateDetailedMessage(ObjectClass.punisher, PlanetSideGUID(1703), ObjectCreateMessageParent(PlanetSideGUID(75), 2), obj)
|
||||
val msg = ObjectCreateDetailedMessage(
|
||||
ObjectClass.punisher,
|
||||
PlanetSideGUID(1703),
|
||||
ObjectCreateMessageParent(PlanetSideGUID(75), 2),
|
||||
obj
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_punisher
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class MountedVehiclesTest extends Specification {
|
|||
guid mustEqual PlanetSideGUID(4308)
|
||||
parent.isEmpty mustEqual true
|
||||
data match {
|
||||
case vdata : VehicleData =>
|
||||
case vdata: VehicleData =>
|
||||
vdata.pos.coord mustEqual Vector3(4571.6875f, 5602.1875f, 93)
|
||||
vdata.pos.orient mustEqual Vector3(11.25f, 2.8125f, 92.8125f)
|
||||
vdata.pos.vel.contains(Vector3(31.71875f, 8.875f, -0.03125f)) mustEqual true
|
||||
|
|
@ -53,7 +53,13 @@ class MountedVehiclesTest extends Specification {
|
|||
case PlayerData(None, app, char, Some(InventoryData(inv)), DrawnSlot.None) =>
|
||||
app match {
|
||||
case CharacterAppearanceData(a, b, ribbons) =>
|
||||
a.app mustEqual BasicCharacterData("ScrawnyRonnie", PlanetSideEmpire.TR, CharacterGender.Male, 5, CharacterVoice.Voice5)
|
||||
a.app mustEqual BasicCharacterData(
|
||||
"ScrawnyRonnie",
|
||||
PlanetSideEmpire.TR,
|
||||
CharacterGender.Male,
|
||||
5,
|
||||
CharacterVoice.Voice5
|
||||
)
|
||||
a.data.bops mustEqual false
|
||||
a.data.v1 mustEqual false
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
|
|
@ -131,7 +137,7 @@ class MountedVehiclesTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (Scrawny Ronnie's mosquito)" in {
|
||||
val a : Int=>CharacterAppearanceA = CharacterAppearanceA(
|
||||
val a: Int => CharacterAppearanceA = CharacterAppearanceA(
|
||||
BasicCharacterData(
|
||||
"ScrawnyRonnie",
|
||||
PlanetSideEmpire.TR,
|
||||
|
|
@ -158,7 +164,7 @@ class MountedVehiclesTest extends Specification {
|
|||
0,
|
||||
0
|
||||
)
|
||||
val b : (Boolean,Int)=>CharacterAppearanceB = CharacterAppearanceB(
|
||||
val b: (Boolean, Int) => CharacterAppearanceB = CharacterAppearanceB(
|
||||
316554L,
|
||||
"Black Beret Armoured Corps",
|
||||
23,
|
||||
|
|
@ -167,7 +173,8 @@ class MountedVehiclesTest extends Specification {
|
|||
false,
|
||||
false,
|
||||
false,
|
||||
-11.25f, 0,
|
||||
-11.25f,
|
||||
0,
|
||||
false,
|
||||
GrenadeState.None,
|
||||
false,
|
||||
|
|
@ -178,8 +185,9 @@ class MountedVehiclesTest extends Specification {
|
|||
None
|
||||
)
|
||||
|
||||
val app : Int=>CharacterAppearanceData = CharacterAppearanceData(
|
||||
a, b,
|
||||
val app: Int => CharacterAppearanceData = CharacterAppearanceData(
|
||||
a,
|
||||
b,
|
||||
RibbonBars(
|
||||
MeritCommendation.MarkovVeteran,
|
||||
MeritCommendation.HeavyInfantry4,
|
||||
|
|
@ -187,31 +195,66 @@ class MountedVehiclesTest extends Specification {
|
|||
MeritCommendation.SixYearTR
|
||||
)
|
||||
)
|
||||
val char : (Boolean,Boolean)=>CharacterData = CharacterData(
|
||||
100, 0,
|
||||
val char: (Boolean, Boolean) => CharacterData = CharacterData(
|
||||
100,
|
||||
0,
|
||||
UniformStyle.ThirdUpgrade,
|
||||
7,
|
||||
5,
|
||||
Nil,
|
||||
Some(Cosmetics(true, true, true, true, false))
|
||||
)
|
||||
val inv : InventoryData = InventoryData(
|
||||
val inv: InventoryData = InventoryData(
|
||||
List(
|
||||
InternalSlot(ObjectClass.medicalapplicator, PlanetSideGUID(4201), 0,
|
||||
WeaponData(CommonFieldData(PlanetSideEmpire.TR), 0, List(InternalSlot(ObjectClass.health_canister, PlanetSideGUID(3472), 0, CommonFieldData()(false))))
|
||||
InternalSlot(
|
||||
ObjectClass.medicalapplicator,
|
||||
PlanetSideGUID(4201),
|
||||
0,
|
||||
WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.TR),
|
||||
0,
|
||||
List(InternalSlot(ObjectClass.health_canister, PlanetSideGUID(3472), 0, CommonFieldData()(false)))
|
||||
)
|
||||
),
|
||||
InternalSlot(ObjectClass.bank, PlanetSideGUID(2952), 1,
|
||||
WeaponData(CommonFieldData(PlanetSideEmpire.TR), 0, List(InternalSlot(ObjectClass.armor_canister, PlanetSideGUID(3758), 0, CommonFieldData()(false))))
|
||||
InternalSlot(
|
||||
ObjectClass.bank,
|
||||
PlanetSideGUID(2952),
|
||||
1,
|
||||
WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.TR),
|
||||
0,
|
||||
List(InternalSlot(ObjectClass.armor_canister, PlanetSideGUID(3758), 0, CommonFieldData()(false)))
|
||||
)
|
||||
),
|
||||
InternalSlot(ObjectClass.mini_chaingun, PlanetSideGUID(2929), 2,
|
||||
WeaponData(CommonFieldData(PlanetSideEmpire.TR), 0, List(InternalSlot(ObjectClass.bullet_9mm, PlanetSideGUID(3292), 0, CommonFieldData()(false))))
|
||||
InternalSlot(
|
||||
ObjectClass.mini_chaingun,
|
||||
PlanetSideGUID(2929),
|
||||
2,
|
||||
WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.TR),
|
||||
0,
|
||||
List(InternalSlot(ObjectClass.bullet_9mm, PlanetSideGUID(3292), 0, CommonFieldData()(false)))
|
||||
)
|
||||
),
|
||||
InternalSlot(ObjectClass.chainblade, PlanetSideGUID(3222), 4,
|
||||
WeaponData(CommonFieldData(PlanetSideEmpire.TR), 0, List(InternalSlot(ObjectClass.melee_ammo, PlanetSideGUID(3100), 0, CommonFieldData()(false))))
|
||||
InternalSlot(
|
||||
ObjectClass.chainblade,
|
||||
PlanetSideGUID(3222),
|
||||
4,
|
||||
WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.TR),
|
||||
0,
|
||||
List(InternalSlot(ObjectClass.melee_ammo, PlanetSideGUID(3100), 0, CommonFieldData()(false)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
val player = VehicleData.PlayerData(app, char, inv, DrawnSlot.None, VehicleData.InitialStreamLengthToSeatEntries(true, VehicleFormat.Variant))
|
||||
val player = VehicleData.PlayerData(
|
||||
app,
|
||||
char,
|
||||
inv,
|
||||
DrawnSlot.None,
|
||||
VehicleData.InitialStreamLengthToSeatEntries(true, VehicleFormat.Variant)
|
||||
)
|
||||
val obj = VehicleData(
|
||||
PlacementData(
|
||||
Vector3(4571.6875f, 5602.1875f, 93),
|
||||
|
|
@ -221,16 +264,26 @@ class MountedVehiclesTest extends Specification {
|
|||
CommonFieldData(PlanetSideEmpire.TR, false, false, false, None, false, Some(false), None, PlanetSideGUID(3776)),
|
||||
false,
|
||||
255,
|
||||
false, false,
|
||||
false,
|
||||
false,
|
||||
DriveState.Mobile,
|
||||
false, false, false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
Some(VariantVehicleData(7)),
|
||||
Some(
|
||||
InventoryData(
|
||||
List(
|
||||
InternalSlot(ObjectClass.avatar, PlanetSideGUID(3776), 0, player),
|
||||
InternalSlot(ObjectClass.rotarychaingun_mosquito, PlanetSideGUID(3602), 1,
|
||||
WeaponData(CommonFieldData(), 0, List(InternalSlot(ObjectClass.bullet_12mm, PlanetSideGUID(3538), 0, CommonFieldData()(false))))
|
||||
InternalSlot(
|
||||
ObjectClass.rotarychaingun_mosquito,
|
||||
PlanetSideGUID(3602),
|
||||
1,
|
||||
WeaponData(
|
||||
CommonFieldData(),
|
||||
0,
|
||||
List(InternalSlot(ObjectClass.bullet_12mm, PlanetSideGUID(3538), 0, CommonFieldData()(false)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -241,4 +294,3 @@ class MountedVehiclesTest extends Specification {
|
|||
pkt mustEqual string_mosquito_seated
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue