mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-15 20:53:38 +00:00
31 lines
808 B
Scala
31 lines
808 B
Scala
// Copyright (c) 2017 PSForever
|
|
package game
|
|
|
|
import net.psforever.types.{MeritCommendation, Vector3}
|
|
import org.specs2.mutable._
|
|
import net.psforever.packet._
|
|
import net.psforever.packet.game._
|
|
import scodec.bits._
|
|
|
|
class DamageWithPositionMessageTest extends Specification {
|
|
val string = hex"A6 11 6C2D7 65535 CA16"
|
|
|
|
"decode" in {
|
|
PacketCoding.DecodePacket(string).require match {
|
|
case DamageWithPositionMessage(unk, pos) =>
|
|
unk mustEqual 17
|
|
pos.x mustEqual 3674.8438f
|
|
pos.y mustEqual 2726.789f
|
|
pos.z mustEqual 91.15625f
|
|
case _ =>
|
|
ko
|
|
}
|
|
}
|
|
|
|
"encode" in {
|
|
val msg = DamageWithPositionMessage(17, Vector3(3674.8438f, 2726.789f, 91.15625f))
|
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
|
|
|
pkt mustEqual string
|
|
}
|
|
}
|