This commit is contained in:
Aphedox 2016-08-13 19:12:21 -05:00
parent f145fd49f2
commit e326f454e5
3 changed files with 25 additions and 4 deletions

View file

@ -7,9 +7,9 @@ import scodec.codecs._
/**
* The object_guid space for SetEmpireMessage is continent specific.
* SetEmpireMessage is usually followed by HackMessage (indicating the hack disposition of the same object_guid)
* SetEmpireMessage is usually followed by HackMessage (indicating the hack disposition of the same building_guid)
*/
final case class SetEmpireMessage(continent_guid : PlanetSideGUID,
final case class SetEmpireMessage(building_guid : PlanetSideGUID,
empire : PlanetSideEmpire.Value)
extends PlanetSideGamePacket {
type Packet = SetEmpireMessage
@ -19,7 +19,7 @@ final case class SetEmpireMessage(continent_guid : PlanetSideGUID,
object SetEmpireMessage extends Marshallable[SetEmpireMessage] {
implicit val codec : Codec[SetEmpireMessage] = (
("object_guid" | PlanetSideGUID.codec) ::
("building_guid" | PlanetSideGUID.codec) ::
("empire" | PlanetSideEmpire.codec)
).as[SetEmpireMessage]
}

View file

@ -796,6 +796,27 @@ class GamePacketTest extends Specification {
}
}
"SetEmpireMessage" should {
val string = hex"24 02 00 80"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case SetEmpireMessage(building_guid, empire) =>
building_guid mustEqual PlanetSideGUID(2)
empire mustEqual PlanetSideEmpire.VS
case default =>
ko
}
}
"encode" in {
val msg = SetEmpireMessage(PlanetSideGUID(2), PlanetSideEmpire.VS)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}
"PingMsg" should {
val packet = hex"1a 00000000 b0360000"

View file

@ -140,7 +140,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
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)
// VS Sanc specific object_guids
// These building_guids are specfic to VS Sanc
sendResponse(PacketCoding.CreateGamePacket(0, SetEmpireMessage(PlanetSideGUID(2), PlanetSideEmpire.VS))) //HART building C
sendResponse(PacketCoding.CreateGamePacket(0, SetEmpireMessage(PlanetSideGUID(29), PlanetSideEmpire.NC))) //South Villa Gun Tower