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. * 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. * This owes to the unique activation trigger for that implant - a near-death experience of ~0HP.
* @param player_guid the player * @param player_guid the player
* @param unk1 na * @param action 2 to init, 3 to activate
* @param unk2 na * @param implantSlot na
* @param implant the implant * @param status 0 to uninit or unactivate, 1 to init or activate
*/ */
final case class AvatarImplantMessage(player_guid : PlanetSideGUID, final case class AvatarImplantMessage(player_guid : PlanetSideGUID,
unk1 : Int, action : Int,
unk2 : Int, implantSlot : Int,
implant : ImplantType.Value) status : Int)
extends PlanetSideGamePacket { extends PlanetSideGamePacket {
type Packet = AvatarImplantMessage type Packet = AvatarImplantMessage
def opcode = GamePacketOpcode.AvatarImplantMessage def opcode = GamePacketOpcode.AvatarImplantMessage
@ -29,8 +29,8 @@ final case class AvatarImplantMessage(player_guid : PlanetSideGUID,
object AvatarImplantMessage extends Marshallable[AvatarImplantMessage] { object AvatarImplantMessage extends Marshallable[AvatarImplantMessage] {
implicit val codec : Codec[AvatarImplantMessage] = ( implicit val codec : Codec[AvatarImplantMessage] = (
("player_guid" | PlanetSideGUID.codec) :: ("player_guid" | PlanetSideGUID.codec) ::
("unk1" | uintL(3)) :: ("action" | uintL(3)) ::
("unk2" | uint2L) :: ("implantSlot" | uint2L) ::
("implant" | ImplantType.codec) ("status" | uint4L)
).as[AvatarImplantMessage] ).as[AvatarImplantMessage]
} }

View file

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