mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-26 14:25:21 +00:00
initial work on packet and tests
This commit is contained in:
parent
be0902fbc4
commit
ddeb5b8188
3 changed files with 65 additions and 1 deletions
|
|
@ -0,0 +1,31 @@
|
|||
// 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
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue