mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-20 02:24:45 +00:00
Packet: ContinentalLockUpdateMessage (#44)
* added ContinentalLockUpdateMessage packet * adjustment to ContinentalLockUpdateMessage scaladoc * changing the type of empire in ContinentalLockUpdateMessage to a PlanetSideEmpire value called NEUTRAL
This commit is contained in:
parent
fc2ef50be6
commit
c92e1c7d84
|
|
@ -519,7 +519,7 @@ object GamePacketOpcode extends Enumeration {
|
|||
case WarpgateResponse => noDecoder(opcode)
|
||||
case DamageWithPositionMessage => noDecoder(opcode)
|
||||
case GenericActionMessage => noDecoder(opcode)
|
||||
case ContinentalLockUpdateMessage => noDecoder(opcode)
|
||||
case ContinentalLockUpdateMessage => game.ContinentalLockUpdateMessage.decode
|
||||
case AvatarGrenadeStateMessage => noDecoder(opcode)
|
||||
|
||||
// OPCODE 170
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
// 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._
|
||||
|
||||
/**
|
||||
* Create a dispatched game packet that instructs the client to update the user about continents that are conquered.
|
||||
*
|
||||
* This generates the event message "The [empire] have captured [continent]."
|
||||
* If the continent_guid is not a valid zone, no message is displayed.
|
||||
* If empire is not a valid empire, no message is displayed.
|
||||
*
|
||||
* @param continent_guid identifies the zone (continent)
|
||||
* @param empire identifies the empire; this value is matchable against PlanetSideEmpire
|
||||
*/
|
||||
final case class ContinentalLockUpdateMessage(continent_guid : PlanetSideGUID,
|
||||
empire : PlanetSideEmpire.Value) // 00 for TR, 40 for NC, 80 for VS; C0 generates no message
|
||||
extends PlanetSideGamePacket {
|
||||
type Packet = ContinentalLockUpdateMessage
|
||||
def opcode = GamePacketOpcode.ContinentalLockUpdateMessage
|
||||
def encode = ContinentalLockUpdateMessage.encode(this)
|
||||
}
|
||||
|
||||
object ContinentalLockUpdateMessage extends Marshallable[ContinentalLockUpdateMessage] {
|
||||
implicit val codec : Codec[ContinentalLockUpdateMessage] = (
|
||||
("continent_guid" | PlanetSideGUID.codec) ::
|
||||
("empire" | PlanetSideEmpire.codec)
|
||||
).as[ContinentalLockUpdateMessage]
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ object ServerType extends Enumeration(1) {
|
|||
|
||||
object PlanetSideEmpire extends Enumeration {
|
||||
type Type = Value
|
||||
val TR, NC, VS = Value
|
||||
val TR, NC, VS, NEUTRAL = Value
|
||||
|
||||
implicit val codec = PacketHelpers.createEnumerationCodec(this, uint2L)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -624,6 +624,27 @@ class GamePacketTest extends Specification {
|
|||
}
|
||||
}
|
||||
|
||||
"ContinentalLockUpdateMessage" should {
|
||||
val string = hex"A8 16 00 40"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case ContinentalLockUpdateMessage(continent_guid, empire) =>
|
||||
continent_guid mustEqual PlanetSideGUID(22)
|
||||
empire mustEqual PlanetSideEmpire.NC
|
||||
case default =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = ContinentalLockUpdateMessage(PlanetSideGUID(22), PlanetSideEmpire.NC)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
|
||||
"WeaponFireMessage" should {
|
||||
val string = hex"34 44130029272F0B5DFD4D4EC5C00009BEF78172003FC0"
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
|||
// XXX: hardcoded shit
|
||||
sendRawResponse(hex"31 85 6D 61 70 31 33 85 68 6F 6D 65 33 A4 9C 19 00 00 00 AE 30 5E 70 00 ")
|
||||
sendRawResponse(objectHex)
|
||||
|
||||
sendResponse(PacketCoding.CreateGamePacket(0, ContinentalLockUpdateMessage(PlanetSideGUID(13), PlanetSideEmpire.VS))) // "The VS have captured the VS Sanctuary."
|
||||
|
||||
sendResponse(PacketCoding.CreateGamePacket(0, SetCurrentAvatarMessage(PlanetSideGUID(guid),0,0)))
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
|
|
|||
Loading…
Reference in a new issue