Packet: BuildingInfoUpdateMessage (#62)

* Add BuildingInfoUpdateMessage packet

* Add BuildingInfoUpdateMessage test

* fix small typo in comment

* name and rename some fields

* also rename fields in tests
This commit is contained in:
aphedox 2016-08-16 01:46:02 -05:00 committed by pschord
parent a37fb3214c
commit 693763bfda
4 changed files with 168 additions and 1 deletions

View file

@ -861,6 +861,79 @@ class GamePacketTest extends Specification {
}
}
"BuildingInfoUpdateMessage" should {
val string = hex"a0 04 00 09 00 16 00 00 00 00 80 00 00 00 17 00 00 00 00 00 00 40"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case BuildingInfoUpdateMessage(continent_guid : PlanetSideGUID,
building_guid : PlanetSideGUID,
ntu_level : Int,
is_hacked : Boolean,
empire_hack : PlanetSideEmpire.Value,
hack_time_remaining : Long,
empire_own : PlanetSideEmpire.Value,
unk1 : Long,
generator_state : PlanetSideGeneratorState.Value,
spawn_tubes_normal : Boolean,
force_dome_active : Boolean,
lattice_benefit : Int,
unk3 : Int,
unk4 : Int,
unk5 : Long,
unk6 : Boolean,
unk7 : Int,
boost_spawn_pain : Boolean,
boost_generator_pain : Boolean) =>
continent_guid mustEqual PlanetSideGUID(4)
building_guid mustEqual PlanetSideGUID(9)
ntu_level mustEqual 1
is_hacked mustEqual false
empire_hack mustEqual PlanetSideEmpire.NEUTRAL
hack_time_remaining mustEqual 0
empire_own mustEqual PlanetSideEmpire.NC
unk1 mustEqual 0
generator_state mustEqual PlanetSideGeneratorState.Normal
spawn_tubes_normal mustEqual true
force_dome_active mustEqual false
lattice_benefit mustEqual 28
unk3 mustEqual 0
unk4 mustEqual 0
unk5 mustEqual 0
unk6 mustEqual false
unk7 mustEqual 8
boost_spawn_pain mustEqual false
boost_generator_pain mustEqual false
case default =>
ko
}
}
"encode" in {
val msg = BuildingInfoUpdateMessage(PlanetSideGUID(4),
PlanetSideGUID(9),
1,
false,
PlanetSideEmpire.NEUTRAL,
0,
PlanetSideEmpire.NC,
0,
PlanetSideGeneratorState.Normal,
true,
false,
28,
0,
0,
0,
false,
8,
false,
false)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}
"QuantityUpdateMessage" should {
val string = hex"3D 5300 7B000000"