mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-12 15:04:39 +00:00
Merge pull request #166 from SouNourS/AvatarImplantMessage
Packet: AvatarImplantMessage changes
This commit is contained in:
commit
516c8c3f29
2 changed files with 28 additions and 11 deletions
|
|
@ -12,14 +12,31 @@ 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
|
||||||
* @param unk2 na
|
* 0 : add implant
|
||||||
* @param implant the implant
|
* with status = 0 to 9 (from ImplantType)
|
||||||
|
* 1 : remove implant
|
||||||
|
* seems work with any value in status
|
||||||
|
* 2 : init implant
|
||||||
|
* status : 0 to "uninit"
|
||||||
|
* status : 1 to init
|
||||||
|
* 3 : activate implant
|
||||||
|
* status : 0 to desactivate
|
||||||
|
* status : 1 to activate
|
||||||
|
* 4 : number of implant slots unlocked
|
||||||
|
* status : 0 = no implant slot
|
||||||
|
* status : 1 = first implant slot + "implant message"
|
||||||
|
* status : 2 or 3 = unlock second & third slots
|
||||||
|
* 5 : out of stamina message
|
||||||
|
* status : 0 to stop the lock
|
||||||
|
* status : 1 to active the lock
|
||||||
|
* @param implantSlot : from 0 to 2
|
||||||
|
* @param status : see action
|
||||||
*/
|
*/
|
||||||
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 +46,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]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue