replaced Integer (8u) with three Booleans (1u + 1u + 1u)

This commit is contained in:
FateJH 2017-02-09 21:19:34 -05:00
parent adff3b1638
commit 3c98954a50
3 changed files with 24 additions and 11 deletions

View file

@ -10,21 +10,26 @@ import scodec.codecs._
*
* Change the map name of a warpgate into "Broadcast Warpgate."
* If a proper warpgate is not designated, nothing happens.
* The input state is a byte starting at 00 where the first valid "on" state is 20.
* Subsequent "on" states are 40 values apart - 20, 60, A0, and E0.
* The input state is a byte starting at `00` where the first valid "on" state is `20`.
* Subsequent "on" states are '40' values apart - '20', '60', 'A0', and 'E0'.
* 'C0' is an uncommon value.
* All other numbers (seem to) default to the normal map designation for the warpgate.
*
* Exploration: is this packet merely cosmetic or does it change the functionality of a warpgate too?
* Exploration: are there any differences between the states besides "on" and "off"?
*
* @param continent_guid identifies the zone (continent)
* @param building_guid identifies the warpgate (see BuildingInfoUpdateMessage)
* @param state whether or not a warpgate is considered "broadcast;"
* 00, 20, 80, and A0 are common values; C0 is an uncommon value
* @param building_guid identifies the warpgate (see `BuildingInfoUpdateMessage`)
* @param state1 na
* @param state2 na
* @param is_broadcast if true, the gate replaces its destination text with "Broadcast;"
* the owner faction may shortcut between disconnected gates along the intercontinental lattice
*/
final case class BroadcastWarpgateUpdateMessage(continent_guid : PlanetSideGUID,
building_guid : PlanetSideGUID,
state : Int)
state1 : Boolean,
state2 : Boolean,
is_broadcast : Boolean)
extends PlanetSideGamePacket {
type Packet = BroadcastWarpgateUpdateMessage
def opcode = GamePacketOpcode.BroadcastWarpgateUpdateMessage
@ -35,6 +40,8 @@ object BroadcastWarpgateUpdateMessage extends Marshallable[BroadcastWarpgateUpda
implicit val codec : Codec[BroadcastWarpgateUpdateMessage] = (
("continent_guid" | PlanetSideGUID.codec) ::
("building_guid" | PlanetSideGUID.codec) ::
("state" | uint8L)
("state1" | bool) ::
("state2" | bool) ::
("is_broadcast" | bool)
).as[BroadcastWarpgateUpdateMessage]
}

View file

@ -1445,17 +1445,19 @@ class GamePacketTest extends Specification {
"decode" in {
PacketCoding.DecodePacket(string).require match {
case BroadcastWarpgateUpdateMessage(continent_guid, building_guid, state) =>
case BroadcastWarpgateUpdateMessage(continent_guid, building_guid, state1, state2, state3) =>
continent_guid mustEqual PlanetSideGUID(13)
building_guid mustEqual PlanetSideGUID(1)
state mustEqual 32
state1 mustEqual false
state2 mustEqual false
state3 mustEqual true
case default =>
ko
}
}
"encode" in {
val msg = BroadcastWarpgateUpdateMessage(PlanetSideGUID(13), PlanetSideGUID(1), 32)
val msg = BroadcastWarpgateUpdateMessage(PlanetSideGUID(13), PlanetSideGUID(1), false, false, true)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string

View file

@ -189,7 +189,11 @@ class WorldSessionActor extends Actor with MDCContextAware {
sendResponse(PacketCoding.CreateGamePacket(0, TimeOfDayMessage(1191182336)))
sendResponse(PacketCoding.CreateGamePacket(0, ContinentalLockUpdateMessage(PlanetSideGUID(13), PlanetSideEmpire.VS))) // "The VS have captured the VS Sanctuary."
sendResponse(PacketCoding.CreateGamePacket(0, BroadcastWarpgateUpdateMessage(PlanetSideGUID(13), PlanetSideGUID(1), 32))) // VS Sanctuary: Inactive Warpgate -> Broadcast Warpgate
sendResponse(PacketCoding.CreateGamePacket(0, BroadcastWarpgateUpdateMessage(PlanetSideGUID(13), PlanetSideGUID(1), false, false, true))) // VS Sanctuary: Inactive Warpgate -> Broadcast Warpgate
sendRawResponse(hex"A0 03 00 03 00 06 00 00 00 01 80 00 00 00 10 00 00 00 00 00 00 40")
sendRawResponse(hex"CD 03 00 03 00 00 00 00")
sendResponse(PacketCoding.CreateGamePacket(0, BroadcastWarpgateUpdateMessage(PlanetSideGUID(3), PlanetSideGUID(3), true, false, true)))
sendResponse(PacketCoding.CreateGamePacket(0,BuildingInfoUpdateMessage(
PlanetSideGUID(6), //Ceryshen