found the purpose of the unknown value

This commit is contained in:
FateJH 2017-01-28 22:29:14 -05:00
parent 055a6096a1
commit 50bf69fc91
2 changed files with 34 additions and 11 deletions

View file

@ -6,18 +6,22 @@ import scodec.Codec
import scodec.codecs._ import scodec.codecs._
/** /**
* na * Change the "Empire Status" text in the Interstellar Map zone description for the specified zone.<br>
* <br>
* The `Long` value is applicable to the caverns.
* It indicates how long the given cavern will remain locked until at least one of their geowarps will open during normal rotation.
* As thus, when a cavern has its status as "inactive," this number will always be a non-zero.
* On normal continents, this number is always zero, though a non-zero number will not have any effect anyway.
* @param zone the zone id * @param zone the zone id
* @param empire_status change the "Empire Status" text in the Interstellar Map zone description; * @param empire_status `true` displays the queue availability for the avatar's empire;
* `true` displays the queue availability for the avatar's empire; * `false` displays "Inactive"
* `false` display "Inactive" * @param lock_time how long until the continent naturally unlocks (in ms);
* @param unk na; * only applicable to caverns
* always 0? * @see `ZonePopulationUpdateMessage` for information on population and queues
* @see `ZonePopulationUpdateMessage`
*/ */
final case class ZoneInfoMessage(zone : Int, final case class ZoneInfoMessage(zone : Int,
empire_status : Boolean, empire_status : Boolean,
unk : Long) lock_time : Long)
extends PlanetSideGamePacket { extends PlanetSideGamePacket {
type Packet = ZoneInfoMessage type Packet = ZoneInfoMessage
def opcode = GamePacketOpcode.ZoneInfoMessage def opcode = GamePacketOpcode.ZoneInfoMessage
@ -28,6 +32,6 @@ object ZoneInfoMessage extends Marshallable[ZoneInfoMessage] {
implicit val codec : Codec[ZoneInfoMessage] = ( implicit val codec : Codec[ZoneInfoMessage] = (
("zone" | uint16L) :: ("zone" | uint16L) ::
("empire_status" | bool) :: ("empire_status" | bool) ::
("unk" | uint32L) ("lock_time" | uint32L)
).as[ZoneInfoMessage] ).as[ZoneInfoMessage]
} }

View file

@ -2184,8 +2184,9 @@ class GamePacketTest extends Specification {
"ZoneInfoMessage" should { "ZoneInfoMessage" should {
val string = hex"C6 0C 00 80 00 00 00 00" val string = hex"C6 0C 00 80 00 00 00 00"
val string_cavern = hex"C6 1B 00 1D F9 F3 00 00"
"decode" in { "decode (normal)" in {
PacketCoding.DecodePacket(string).require match { PacketCoding.DecodePacket(string).require match {
case ZoneInfoMessage(zone, empire_status, unk) => case ZoneInfoMessage(zone, empire_status, unk) =>
zone mustEqual 12 zone mustEqual 12
@ -2196,12 +2197,30 @@ class GamePacketTest extends Specification {
} }
} }
"encode" in { "decode (cavern)" in {
PacketCoding.DecodePacket(string_cavern).require match {
case ZoneInfoMessage(zone, empire_status, unk) =>
zone mustEqual 27
empire_status mustEqual false
unk mustEqual 15135547
case default =>
ko
}
}
"encode (normal)" in {
val msg = ZoneInfoMessage(12, true, 0) val msg = ZoneInfoMessage(12, true, 0)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string pkt mustEqual string
} }
"encode (cavern)" in {
val msg = ZoneInfoMessage(27, false, 15135547)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string_cavern
}
} }
"PingMsg" should { "PingMsg" should {