Merge pull request #130 from Fate-JH/begin-zoning

Packet: BeginZoningMessage
This commit is contained in:
Fate-JH 2017-04-24 07:52:10 -04:00 committed by GitHub
commit 34490db890
4 changed files with 57 additions and 1 deletions

View file

@ -398,7 +398,7 @@ object GamePacketOpcode extends Enumeration {
case 0x40 => noDecoder(MountVehicleCargoMsg)
case 0x41 => noDecoder(DismountVehicleCargoMsg)
case 0x42 => noDecoder(CargoMountPointStatusMessage)
case 0x43 => noDecoder(BeginZoningMessage)
case 0x43 => game.BeginZoningMessage.decode
case 0x44 => game.ItemTransactionMessage.decode
case 0x45 => game.ItemTransactionResultMessage.decode
case 0x46 => game.ChangeFireModeMessage.decode

View file

@ -0,0 +1,26 @@
// Copyright (c) 2017 PSForever
package net.psforever.packet.game
import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket}
import scodec.Codec
/**
* Dispatched by the client after the current map has been fully loaded locally and its objects are ready to be initialized.<br>
* <br>
* When the server receives the packet, for each object on that map, it sends the packets to the client:<br>
* - `SetEmpireMessage`<br>
* - `HackMessage`<br>
* - `PlanetSideAttributeMessage`<br>
* - ... and so forth<br>
* Afterwards, an avatar POV is declared and the remaining details about the said avatar are assigned.
*/
final case class BeginZoningMessage()
extends PlanetSideGamePacket {
type Packet = BeginZoningMessage
def opcode = GamePacketOpcode.BeginZoningMessage
def encode = BeginZoningMessage.encode(this)
}
object BeginZoningMessage extends Marshallable[BeginZoningMessage] {
implicit val codec : Codec[BeginZoningMessage] = PacketHelpers.emptyCodec(BeginZoningMessage())
}

View file

@ -0,0 +1,27 @@
// Copyright (c) 2017 PSForever
package game
import org.specs2.mutable._
import net.psforever.packet._
import net.psforever.packet.game._
import scodec.bits._
class BeginZoningMessageTest extends Specification {
val string = hex"43" //yes, just the opcode
"decode" in {
PacketCoding.DecodePacket(string).require match {
case BeginZoningMessage() =>
ok
case _ =>
ko
}
}
"encode" in {
val msg = BeginZoningMessage()
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}

View file

@ -235,6 +235,9 @@ class WorldSessionActor extends Actor with MDCContextAware {
case KeepAliveMessage(code) =>
sendResponse(PacketCoding.CreateGamePacket(0, KeepAliveMessage(0)))
case msg @ BeginZoningMessage() =>
log.info("Reticulating splines ...")
case msg @ PlayerStateMessageUpstream(avatar_guid, pos, vel, unk1, aim_pitch, unk2, seq_time, unk3, is_crouching, is_jumping, unk4, is_cloaking, unk5, unk6) =>
//log.info("PlayerState: " + msg)