AvatarImplantMessage changes

This commit is contained in:
SouNourS 2017-10-02 17:01:49 +02:00
parent be0902fbc4
commit e59c44352b
2 changed files with 11 additions and 11 deletions

View file

@ -12,14 +12,14 @@ import scodec.codecs._
* The implant Second Wind is technically an invalid `ImplantType` for this packet.
* This owes to the unique activation trigger for that implant - a near-death experience of ~0HP.
* @param player_guid the player
* @param unk1 na
* @param unk2 na
* @param implant the implant
* @param action 2 to init, 3 to activate
* @param implantSlot na
* @param status 0 to uninit or unactivate, 1 to init or activate
*/
final case class AvatarImplantMessage(player_guid : PlanetSideGUID,
unk1 : Int,
unk2 : Int,
implant : ImplantType.Value)
action : Int,
implantSlot : Int,
status : Int)
extends PlanetSideGamePacket {
type Packet = AvatarImplantMessage
def opcode = GamePacketOpcode.AvatarImplantMessage
@ -29,8 +29,8 @@ final case class AvatarImplantMessage(player_guid : PlanetSideGUID,
object AvatarImplantMessage extends Marshallable[AvatarImplantMessage] {
implicit val codec : Codec[AvatarImplantMessage] = (
("player_guid" | PlanetSideGUID.codec) ::
("unk1" | uintL(3)) ::
("unk2" | uint2L) ::
("implant" | ImplantType.codec)
("action" | uintL(3)) ::
("implantSlot" | uint2L) ::
("status" | uint4L)
).as[AvatarImplantMessage]
}

View file

@ -16,14 +16,14 @@ class AvatarImplantMessageTest extends Specification {
player_guid mustEqual PlanetSideGUID(3171)
unk1 mustEqual 3
unk2 mustEqual 1
implant mustEqual ImplantType.Targeting
implant mustEqual 1
case _ =>
ko
}
}
"encode" in {
val msg = AvatarImplantMessage(PlanetSideGUID(3171), 3, 1, ImplantType.Targeting)
val msg = AvatarImplantMessage(PlanetSideGUID(3171), 3, 1, 1)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string