mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-20 02:24:45 +00:00
Packet: CharacterInfoMessage
This commit is contained in:
parent
50fb65ac57
commit
d4c414df36
|
|
@ -76,6 +76,11 @@ object PacketHelpers {
|
|||
Codec[HNil].xmap[T](from, to)
|
||||
}
|
||||
|
||||
// NOTE: enumerations in scala can't be represented by more than an Int anyways, so this conversion shouldnt matter.
|
||||
// This is only to overload createEnumerationCodec to work with uint32[L] codecs (which are Long)
|
||||
def createLongEnumerationCodec[E <: Enumeration](enum : E, storageCodec : Codec[Long]) : Codec[E#Value] = {
|
||||
createEnumerationCodec(enum, storageCodec.xmap[Int](_.toInt, _.toLong))
|
||||
}
|
||||
|
||||
def createEnumerationCodec[E <: Enumeration](enum : E, storageCodec : Codec[Int]) : Codec[E#Value] = {
|
||||
type Struct = Int :: HNil
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
// 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._
|
||||
|
||||
|
||||
case class PlanetSideZoneID(zoneId : Long)
|
||||
|
||||
object PlanetSideZoneID {
|
||||
implicit val codec = uint32L.as[PlanetSideZoneID]
|
||||
}
|
||||
|
||||
case class PlanetSideGUID(guid : Int)
|
||||
|
||||
object PlanetSideGUID {
|
||||
implicit val codec = uint16L.as[PlanetSideGUID]
|
||||
}
|
||||
|
||||
/**
|
||||
* Is sent by the PlanetSide world server when sending character selection screen state. Provides metadata
|
||||
* about a certain character for rendering purposes (zone background, etc). Acts as an array insert for the
|
||||
* client character list. A blank displayed character is most likely caused by a mismatch between an
|
||||
* ObjectCreateMessage GUID and the GUID from this message.
|
||||
*/
|
||||
final case class CharacterInfoMessage(zoneId : PlanetSideZoneID,
|
||||
charId : Long,
|
||||
guid : PlanetSideGUID,
|
||||
secondsSinceLastLogin : Long)
|
||||
extends PlanetSideGamePacket {
|
||||
type Packet = CharacterInfoMessage
|
||||
def opcode = GamePacketOpcode.CharacterInfoMessage
|
||||
def encode = CharacterInfoMessage.encode(this)
|
||||
}
|
||||
|
||||
object CharacterInfoMessage extends Marshallable[CharacterInfoMessage] {
|
||||
implicit val codec : Codec[CharacterInfoMessage] = (
|
||||
("unknown" | uint32L).unit(0) ::
|
||||
("zoneId" | PlanetSideZoneID.codec) ::
|
||||
("charId" | uint32L) ::
|
||||
("charGUID" | PlanetSideGUID.codec) ::
|
||||
("unknown_bit" | bool.unit(false)) ::
|
||||
("seconds_since_last_login" | uint32L)
|
||||
).as[CharacterInfoMessage]
|
||||
}
|
||||
Loading…
Reference in a new issue