initial MailMessage packet work and testing

This commit is contained in:
FateJH 2017-04-21 19:56:01 -04:00
parent 68473dda45
commit 053e95d892
3 changed files with 66 additions and 1 deletions

View file

@ -605,7 +605,7 @@ object GamePacketOpcode extends Enumeration {
// OPCODES 0xf0-f3
case 0xf0 => noDecoder(QueueTimedHelpMessage)
case 0xf1 => noDecoder(MailMessage)
case 0xf1 => game.MailMessage.decode
case 0xf2 => noDecoder(GameVarUpdate)
case 0xf3 => noDecoder(ClientCheatedMessage)
case default => noDecoder(opcode)

View file

@ -0,0 +1,35 @@
// Copyright (c) 2017 PSForever
package net.psforever.packet.game
import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket}
import scodec.Codec
import scodec.codecs._
/**
* Dispatched from the server, sending a "priority message" to the given client's avatar.
* The messaging inbox is generally accessible through the use of `alt`+`i`.
* It is also made accessible through use of an icon in the lower right corner when there is an outstanding message.<br>
* <br>
* Exploration:<br>
* How does the PlanetSide Classic mail system work?
* At the moment, it only seems possible to receive and read mail from the server.
* @param sender the name of the player who sent the mail
* @param subject the subject
* @param message the message
*/
final case class MailMessage(sender : String,
subject : String,
message : String
) extends PlanetSideGamePacket {
type Packet = MailMessage
def opcode = GamePacketOpcode.MailMessage
def encode = MailMessage.encode(this)
}
object MailMessage extends Marshallable[MailMessage] {
implicit val codec : Codec[MailMessage] = (
("sender" | PacketHelpers.encodedString) ::
("subject" | PacketHelpers.encodedString) ::
("message" | PacketHelpers.encodedString)
).as[MailMessage]
}