mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-25 05:45:23 +00:00
added FavoritesMessage packet and tests
This commit is contained in:
parent
daa22c572e
commit
3789bc2ae5
3 changed files with 88 additions and 1 deletions
|
|
@ -433,7 +433,7 @@ object GamePacketOpcode extends Enumeration {
|
|||
case 0x5f => noDecoder(FavoritesResponse)
|
||||
|
||||
// OPCODES 0x60-6f
|
||||
case 0x60 => noDecoder(FavoritesMessage)
|
||||
case 0x60 => game.FavoritesMessage.decode
|
||||
case 0x61 => noDecoder(ObjectDetectedMessage)
|
||||
case 0x62 => noDecoder(SplashHitMessage)
|
||||
case 0x63 => noDecoder(SetChatFilterMessage)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) 2016 PSForever.net to present
|
||||
package net.psforever.packet.game
|
||||
|
||||
import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket}
|
||||
import scodec.Codec
|
||||
import scodec.codecs._
|
||||
|
||||
/**
|
||||
* na
|
||||
* @param list na
|
||||
* @param player_guid the player
|
||||
* @param line na
|
||||
* @param subject na
|
||||
* @param armor the type of exo-suit
|
||||
* @param subtype the exo-suit subtype, if any
|
||||
*/
|
||||
final case class FavoritesMessage(list : Int,
|
||||
player_guid : PlanetSideGUID,
|
||||
line : Int,
|
||||
subject : String,
|
||||
armor : Option[Int] = None,
|
||||
subtype : Option[Int] = None)
|
||||
extends PlanetSideGamePacket {
|
||||
type Packet = FavoritesMessage
|
||||
def opcode = GamePacketOpcode.FavoritesMessage
|
||||
def encode = FavoritesMessage.encode(this)
|
||||
}
|
||||
|
||||
object FavoritesMessage extends Marshallable[FavoritesMessage] {
|
||||
implicit val codec : Codec[FavoritesMessage] = (
|
||||
("list" | uintL(2)) >>:~ { value =>
|
||||
("player_guid" | PlanetSideGUID.codec) ::
|
||||
("line" | uintL(4)) ::
|
||||
("subject" | PacketHelpers.encodedWideStringAligned(2)) ::
|
||||
conditional(value == 0, "armor" | uintL(3)) ::
|
||||
conditional(value == 0, "subtype" | uintL(3))
|
||||
}).as[FavoritesMessage]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue