mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-12 16:40:32 +00:00
handling Infantry packets, which have an extra field; added tests and comments
This commit is contained in:
parent
3789bc2ae5
commit
bc2a231d45
2 changed files with 54 additions and 20 deletions
|
|
@ -856,22 +856,20 @@ class GamePacketTest extends Specification {
|
|||
|
||||
"decode (for infantry)" in {
|
||||
PacketCoding.DecodePacket(stringInfantry).require match {
|
||||
case FavoritesMessage(list, player_guid, line, subject, armor, subtype) =>
|
||||
case FavoritesMessage(list, player_guid, line, label, armor) =>
|
||||
list mustEqual 0
|
||||
player_guid mustEqual PlanetSideGUID(3760)
|
||||
line mustEqual 0
|
||||
subject mustEqual "Agile (basic)"
|
||||
label mustEqual "Agile (basic)"
|
||||
armor.isDefined mustEqual true
|
||||
armor.get mustEqual 1
|
||||
subtype.isDefined mustEqual true
|
||||
subtype.get mustEqual 0
|
||||
case default =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode (for infantry)" in {
|
||||
val msg = FavoritesMessage(0, PlanetSideGUID(3760), 0, "Agile (basic)", Option(1), Option(0))
|
||||
val msg = FavoritesMessage(0, PlanetSideGUID(3760), 0, "Agile (basic)", Option(1))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual stringInfantry
|
||||
|
|
@ -879,13 +877,12 @@ class GamePacketTest extends Specification {
|
|||
|
||||
"decode (for vehicles)" in {
|
||||
PacketCoding.DecodePacket(stringVehicles).require match {
|
||||
case FavoritesMessage(list, player_guid, line, subject, armor, subtype) =>
|
||||
case FavoritesMessage(list, player_guid, line, label, armor) =>
|
||||
list mustEqual 1
|
||||
player_guid mustEqual PlanetSideGUID(4210)
|
||||
line mustEqual 0
|
||||
subject mustEqual "Skyguard"
|
||||
label mustEqual "Skyguard"
|
||||
armor.isDefined mustEqual false
|
||||
subtype.isDefined mustEqual false
|
||||
case default =>
|
||||
ko
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue