Packet: AvatarImplantMessage (#108)

* added initial AvatarImplantMessage packet

* rebased AvatarImplantMessage and working test

* converting implant types

* changing format of Enum from axx_bxx to AxxBxx
This commit is contained in:
Fate-JH 2017-03-05 14:39:04 -05:00 committed by pschord
parent a6a51009fa
commit 30f679238b
3 changed files with 100 additions and 1 deletions

View file

@ -0,0 +1,30 @@
// Copyright (c) 2016 PSForever.net to present
package game
import org.specs2.mutable._
import net.psforever.packet._
import net.psforever.packet.game._
import scodec.bits._
class AvatarImplantMessageTest extends Specification {
val string = hex"58 630C 68 80"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case AvatarImplantMessage(player_guid, unk1, unk2, implant) =>
player_guid mustEqual PlanetSideGUID(3171)
unk1 mustEqual 3
unk2 mustEqual 1
implant mustEqual ImplantType.Targeting
case _ =>
ko
}
}
"encode" in {
val msg = AvatarImplantMessage(PlanetSideGUID(3171), 3, 1, ImplantType.Targeting)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}