mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-29 15:55:23 +00:00
Merge pull request #149 from Fate-JH/deploy-request
Packet: DeployRequestMessage
This commit is contained in:
commit
861a611707
4 changed files with 98 additions and 1 deletions
|
|
@ -407,7 +407,7 @@ object GamePacketOpcode extends Enumeration {
|
||||||
case 0x48 => game.TimeOfDayMessage.decode
|
case 0x48 => game.TimeOfDayMessage.decode
|
||||||
case 0x49 => noDecoder(UnknownMessage73)
|
case 0x49 => noDecoder(UnknownMessage73)
|
||||||
case 0x4a => noDecoder(SpawnRequestMessage)
|
case 0x4a => noDecoder(SpawnRequestMessage)
|
||||||
case 0x4b => noDecoder(DeployRequestMessage)
|
case 0x4b => game.DeployRequestMessage.decode
|
||||||
case 0x4c => noDecoder(UnknownMessage76)
|
case 0x4c => noDecoder(UnknownMessage76)
|
||||||
case 0x4d => game.RepairMessage.decode
|
case 0x4d => game.RepairMessage.decode
|
||||||
case 0x4e => noDecoder(ServerVehicleOverrideMsg)
|
case 0x4e => noDecoder(ServerVehicleOverrideMsg)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
// Copyright (c) 2017 PSForever
|
||||||
|
package net.psforever.packet.game
|
||||||
|
|
||||||
|
import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket}
|
||||||
|
import net.psforever.types.Vector3
|
||||||
|
import scodec.Codec
|
||||||
|
import scodec.codecs._
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatched by the client when the player attempts to deploy a vehicle.
|
||||||
|
* Dispatched by the server to cause a specific vehicle to be deployed.<br>
|
||||||
|
* <br>
|
||||||
|
* "Deployment" usually isn't enough by itself.
|
||||||
|
* It only changes the physical configuration of the vehicle.
|
||||||
|
* (It's an animation request/trigger?)
|
||||||
|
* Anything that can be "deployed" does so for a very specific reason, to perform a complex function.
|
||||||
|
* These functions are not immediately available.
|
||||||
|
* Attributes must be set properly for the transition between behaviors to occur properly.
|
||||||
|
* In addition, the recently-deployed vehicles will hang in a state of limbo if not configured properly.
|
||||||
|
* It will not even dispatch an un-deploy request upon command in this state.
|
||||||
|
* <br>
|
||||||
|
* This packet has nothing to do with ACE deployables.
|
||||||
|
* @param player_guid the player requesting the deployment
|
||||||
|
* @param vehicle_guid the vehicle to be deployed
|
||||||
|
* @param unk1 na;
|
||||||
|
* usually 2
|
||||||
|
* @param unk2 na;
|
||||||
|
* usually 0
|
||||||
|
* @param unk3 na
|
||||||
|
* @param pos the position where the object will deploy itself
|
||||||
|
*/
|
||||||
|
final case class DeployRequestMessage(player_guid : PlanetSideGUID,
|
||||||
|
vehicle_guid : PlanetSideGUID,
|
||||||
|
unk1 : Int,
|
||||||
|
unk2 : Int,
|
||||||
|
unk3 : Boolean,
|
||||||
|
pos : Vector3)
|
||||||
|
extends PlanetSideGamePacket {
|
||||||
|
type Packet = DeployRequestMessage
|
||||||
|
def opcode = GamePacketOpcode.DeployRequestMessage
|
||||||
|
def encode = DeployRequestMessage.encode(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
object DeployRequestMessage extends Marshallable[DeployRequestMessage] {
|
||||||
|
implicit val codec : Codec[DeployRequestMessage] = (
|
||||||
|
("player_guid" | PlanetSideGUID.codec) ::
|
||||||
|
("deploy_guid" | PlanetSideGUID.codec) ::
|
||||||
|
("unk1" | uint(3)) ::
|
||||||
|
("unk2" | uint(5)) ::
|
||||||
|
("unk3" | bool) ::
|
||||||
|
("pos" | Vector3.codec_pos)
|
||||||
|
).as[DeployRequestMessage]
|
||||||
|
}
|
||||||
40
common/src/test/scala/game/DeployRequestMessageTest.scala
Normal file
40
common/src/test/scala/game/DeployRequestMessageTest.scala
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
// Copyright (c) 2017 PSForever
|
||||||
|
package game
|
||||||
|
|
||||||
|
import org.specs2.mutable._
|
||||||
|
import net.psforever.packet._
|
||||||
|
import net.psforever.packet.game._
|
||||||
|
import net.psforever.types.Vector3
|
||||||
|
import scodec.bits._
|
||||||
|
|
||||||
|
class DeployRequestMessageTest extends Specification {
|
||||||
|
val string = hex"4b 4b00 7c01 40 0cf73b52aa6a9300"
|
||||||
|
|
||||||
|
"decode" in {
|
||||||
|
PacketCoding.DecodePacket(string).require match {
|
||||||
|
case DeployRequestMessage(player_guid, vehicle_guid, unk1, unk2, unk3, pos) =>
|
||||||
|
player_guid mustEqual PlanetSideGUID(75)
|
||||||
|
vehicle_guid mustEqual PlanetSideGUID(380)
|
||||||
|
unk1 mustEqual 2
|
||||||
|
unk2 mustEqual 0
|
||||||
|
unk3 mustEqual false
|
||||||
|
pos.x mustEqual 4060.1953f
|
||||||
|
pos.y mustEqual 2218.8281f
|
||||||
|
pos.z mustEqual 155.32812f
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"encode" in {
|
||||||
|
val msg = DeployRequestMessage(
|
||||||
|
PlanetSideGUID(75),
|
||||||
|
PlanetSideGUID(380),
|
||||||
|
2, 0, false,
|
||||||
|
Vector3(4060.1953f, 2218.8281f, 155.32812f)
|
||||||
|
)
|
||||||
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||||
|
|
||||||
|
pkt mustEqual string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -412,6 +412,10 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
sendResponse(PacketCoding.CreateGamePacket(0, msg)) //should be safe; replace with ObjectDetachMessage later
|
sendResponse(PacketCoding.CreateGamePacket(0, msg)) //should be safe; replace with ObjectDetachMessage later
|
||||||
log.info("DismountVehicleMsg: " + msg)
|
log.info("DismountVehicleMsg: " + msg)
|
||||||
|
|
||||||
|
case msg @ DeployRequestMessage(player, entity, unk1, unk2, unk3, pos) =>
|
||||||
|
//if you try to deploy, can not undeploy
|
||||||
|
log.info("DeployRequest: " + msg)
|
||||||
|
|
||||||
case msg @ AvatarGrenadeStateMessage(player_guid, state) =>
|
case msg @ AvatarGrenadeStateMessage(player_guid, state) =>
|
||||||
log.info("AvatarGrenadeStateMessage: " + msg)
|
log.info("AvatarGrenadeStateMessage: " + msg)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue