Merge pull request #138 from Fate-JH/targeting-request

Packet: TargetingImplantRequestMessage
This commit is contained in:
Fate-JH 2017-05-04 19:17:53 -04:00 committed by GitHub
commit 9a1c1338e4
4 changed files with 156 additions and 1 deletions

View file

@ -533,7 +533,7 @@ object GamePacketOpcode extends Enumeration {
case 0xb2 => game.VoiceHostInfo.decode
case 0xb3 => game.BattleplanMessage.decode
case 0xb4 => game.BattleExperienceMessage.decode
case 0xb5 => noDecoder(TargetingImplantRequest)
case 0xb5 => game.TargetingImplantRequest.decode
case 0xb6 => game.ZonePopulationUpdateMessage.decode
case 0xb7 => game.DisconnectMessage.decode
// 0xb8

View file

@ -0,0 +1,36 @@
// Copyright (c) 2017 PSForever
package net.psforever.packet.game
import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket}
import scodec.Codec
import scodec.codecs._
/**
* An entry regarding a specific target.
* @param target_guid the target
* @param unk na
*/
final case class TargetRequest(target_guid : PlanetSideGUID,
unk : Boolean)
/**
* Dispatched by the client when the advanced targeting implant activates to collect status information from the server.<br>
* <br>
* This packet is answered by a `TargetingInfoMessage` with `List` entries of thed corresponding UIDs.
* @param target_list a `List` of targets
*/
final case class TargetingImplantRequest(target_list : List[TargetRequest])
extends PlanetSideGamePacket {
type Packet = TargetingImplantRequest
def opcode = GamePacketOpcode.TargetingImplantRequest
def encode = TargetingImplantRequest.encode(this)
}
object TargetingImplantRequest extends Marshallable[TargetingImplantRequest] {
private val request_codec : Codec[TargetRequest] = (
("target_guid" | PlanetSideGUID.codec) ::
("unk" | bool)
).as[TargetRequest]
implicit val codec : Codec[TargetingImplantRequest] = ("target_list" | listOfN(intL(6), request_codec)).as[TargetingImplantRequest]
}