mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-25 01:23:36 +00:00
Merge pull request #1159 from Resaec/squad_voice_host_request_message
Fully implement the VoiceHostRequest packet
This commit is contained in:
commit
da32c68479
2 changed files with 98 additions and 21 deletions
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package net.psforever.packet.game
|
||||
|
||||
import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket}
|
||||
import net.psforever.types.PlanetSideGUID
|
||||
import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket}
|
||||
import scodec.Codec
|
||||
import scodec.bits.ByteVector
|
||||
import scodec.codecs._
|
||||
|
|
@ -11,21 +10,34 @@ 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
|
||||
*
|
||||
* @param remote_host true if the player provides info for a remote host (remote_ip)
|
||||
* @param port the port to connect to
|
||||
* @param bandwidth the bandwidth set by the player (valid values are 3, 201, 203)
|
||||
* @param remote_ip the IP of the remote voice server, only set if remote_host == true
|
||||
*/
|
||||
final case class VoiceHostRequest(unk: Boolean, player_guid: PlanetSideGUID, data: ByteVector)
|
||||
extends PlanetSideGamePacket {
|
||||
type Packet = VoiceHostRequest
|
||||
final case class VoiceHostRequest(
|
||||
remote_host: Boolean,
|
||||
port: Int,
|
||||
bandwidth: Int,
|
||||
remote_ip: String,
|
||||
data: ByteVector
|
||||
) extends PlanetSideGamePacket {
|
||||
require(port > 0)
|
||||
require(port <= 65535)
|
||||
require(bandwidth == 3 || bandwidth == 201 || bandwidth == 203)
|
||||
require(remote_host == (remote_ip != ""))
|
||||
|
||||
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) ::
|
||||
("remote_host" | bool) ::
|
||||
("port" | uint16L) ::
|
||||
("bandwidth" | uint8L) ::
|
||||
("remote_ip" | PacketHelpers.encodedStringAligned(7)) ::
|
||||
("data" | bytes)
|
||||
).as[VoiceHostRequest]
|
||||
).as[VoiceHostRequest]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue