initial work on DisconnectMessage; it's pretty straightforward, I think

This commit is contained in:
FateJH 2017-01-27 21:16:32 -05:00
parent 2a4cda557e
commit 5855348209
3 changed files with 59 additions and 1 deletions

View file

@ -535,7 +535,7 @@ object GamePacketOpcode extends Enumeration {
case 0xb4 => game.BattleExperienceMessage.decode
case 0xb5 => noDecoder(TargetingImplantRequest)
case 0xb6 => game.ZonePopulationUpdateMessage.decode
case 0xb7 => noDecoder(DisconnectMessage)
case 0xb7 => game.DisconnectMessage.decode
// 0xb8
case 0xb8 => noDecoder(ExperienceAddedMessage)
case 0xb9 => game.OrbitalStrikeWaypointMessage.decode

View file

@ -0,0 +1,36 @@
// 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._
/**
* Dispatched to the client to force a disconnect.<br>
* <br>
* The client's render will fade and be centered with a system textbox with the given message.
* Using the button on the textbox will drop the current world session and return the player to the world select screen.
* Being disconnected like this has no client-based consequences on its own.<br>
* <br>
* Exploration:<br>
* When do the other two messages appear, if at all?
* @param msg the displayed message
* @param unk2 na
* @param unk3 na
*/
final case class DisconnectMessage(msg : String,
unk2 : String = "",
unk3 : String = "")
extends PlanetSideGamePacket {
type Packet = DisconnectMessage
def opcode = GamePacketOpcode.DisconnectMessage
def encode = DisconnectMessage.encode(this)
}
object DisconnectMessage extends Marshallable[DisconnectMessage] {
implicit val codec : Codec[DisconnectMessage] = (
("msg" | PacketHelpers.encodedString) ::
("unk2" | PacketHelpers.encodedString) ::
("unk3" | PacketHelpers.encodedString)
).as[DisconnectMessage]
}