From b01401dd6dd4ce4fb9cb795c35e3432208c34e71 Mon Sep 17 00:00:00 2001 From: FateJH Date: Mon, 9 Jan 2017 07:49:40 -0500 Subject: [PATCH] barebones implementation of the three VoiceHost packets, for completion --- .../psforever/packet/GamePacketOpcode.scala | 6 ++-- .../psforever/packet/game/VoiceHostInfo.scala | 29 +++++++++++++++++ .../psforever/packet/game/VoiceHostKill.scala | 22 +++++++++++++ .../packet/game/VoiceHostRequest.scala | 32 +++++++++++++++++++ 4 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 common/src/main/scala/net/psforever/packet/game/VoiceHostInfo.scala create mode 100644 common/src/main/scala/net/psforever/packet/game/VoiceHostKill.scala create mode 100644 common/src/main/scala/net/psforever/packet/game/VoiceHostRequest.scala diff --git a/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala b/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala index 6e9984e5..9392839d 100644 --- a/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala +++ b/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala @@ -528,9 +528,9 @@ object GamePacketOpcode extends Enumeration { case 0xaf => noDecoder(CSAssistCommentMessage) // OPCODES 0xb0-bf - case 0xb0 => noDecoder(VoiceHostRequest) - case 0xb1 => noDecoder(VoiceHostKill) - case 0xb2 => noDecoder(VoiceHostInfo) + case 0xb0 => game.VoiceHostRequest.decode + case 0xb1 => game.VoiceHostKill.decode + case 0xb2 => game.VoiceHostInfo.decode case 0xb3 => noDecoder(BattleplanMessage) case 0xb4 => noDecoder(BattleExperienceMessage) case 0xb5 => noDecoder(TargetingImplantRequest) diff --git a/common/src/main/scala/net/psforever/packet/game/VoiceHostInfo.scala b/common/src/main/scala/net/psforever/packet/game/VoiceHostInfo.scala new file mode 100644 index 00000000..95661e8b --- /dev/null +++ b/common/src/main/scala/net/psforever/packet/game/VoiceHostInfo.scala @@ -0,0 +1,29 @@ +// Copyright (c) 2016 PSForever.net to present +package net.psforever.packet.game + +import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket} +import scodec.Codec +import scodec.bits.ByteVector +import scodec.codecs._ + +/** + * Used by PlanetSide in conjunction with wiredred/pscs.exe to establish local platoon/squad voice chat. + * We are not focusing on implementation of this feature. + * This packet should not be generated because `VoiceHostRequest` is snubbed. + * @param player_guid the player who sent this info (the originator of voice chat?) + * @param data everything else + */ +final case class VoiceHostInfo(player_guid : PlanetSideGUID, + data : ByteVector) + extends PlanetSideGamePacket { + type Packet = VoiceHostInfo + def opcode = GamePacketOpcode.VoiceHostInfo + def encode = VoiceHostInfo.encode(this) +} + +object VoiceHostInfo extends Marshallable[VoiceHostInfo] { + implicit val codec : Codec[VoiceHostInfo] = ( + ("player_guid" | PlanetSideGUID.codec) :: + ("data" | bytes) + ).as[VoiceHostInfo] +} diff --git a/common/src/main/scala/net/psforever/packet/game/VoiceHostKill.scala b/common/src/main/scala/net/psforever/packet/game/VoiceHostKill.scala new file mode 100644 index 00000000..1acd2ef7 --- /dev/null +++ b/common/src/main/scala/net/psforever/packet/game/VoiceHostKill.scala @@ -0,0 +1,22 @@ +// Copyright (c) 2016 PSForever.net to present +package net.psforever.packet.game + +import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket} +import scodec.Codec + +/** + * Used by PlanetSide in conjunction with wiredred/pscs.exe to establish local platoon/squad voice chat. + * We are not focusing on implementation of this feature. + * As a precaution, all attempts at sending `VoiceHostRequest` should be replied to with a `VoiceHostKill`. + * This packet seems to publish no data. + */ +final case class VoiceHostKill() + extends PlanetSideGamePacket { + type Packet = VoiceHostKill + def opcode = GamePacketOpcode.VoiceHostKill + def encode = VoiceHostKill.encode(this) +} + +object VoiceHostKill extends Marshallable[VoiceHostKill] { + implicit val codec : Codec[VoiceHostKill] = PacketHelpers.emptyCodec(VoiceHostKill()) +} diff --git a/common/src/main/scala/net/psforever/packet/game/VoiceHostRequest.scala b/common/src/main/scala/net/psforever/packet/game/VoiceHostRequest.scala new file mode 100644 index 00000000..371e70df --- /dev/null +++ b/common/src/main/scala/net/psforever/packet/game/VoiceHostRequest.scala @@ -0,0 +1,32 @@ +// Copyright (c) 2016 PSForever.net to present +package net.psforever.packet.game + +import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket} +import scodec.Codec +import scodec.bits.ByteVector +import scodec.codecs._ + +/** + * Used by PlanetSide in conjunction with wiredred/pscs.exe to establish local platoon/squad voice chat. + * We are not focusing on implementation of this feature. + * At the most, we will merely record data about who requested it. + * @param unk na + * @param player_guid the player who sent this request + * @param data everything else + */ +final case class VoiceHostRequest(unk : Boolean, + player_guid : PlanetSideGUID, + data : ByteVector) + extends PlanetSideGamePacket { + type Packet = VoiceHostRequest + def opcode = GamePacketOpcode.VoiceHostRequest + def encode = VoiceHostRequest.encode(this) +} + +object VoiceHostRequest extends Marshallable[VoiceHostRequest] { + implicit val codec : Codec[VoiceHostRequest] = ( + ("unk" | bool) :: + ("player_guid" | PlanetSideGUID.codec) :: + ("data" | bytes) + ).as[VoiceHostRequest] +}