mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-28 23:35:23 +00:00
Merge branch 'master' into feature/VehicleDismountImprovements
This commit is contained in:
commit
12443c6aa5
51 changed files with 2281 additions and 384 deletions
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import scodec.bits._
|
||||
|
||||
class FacilityBenefitShieldChargeRequestMessageTest extends Specification {
|
||||
val string = hex"C2 4C00"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case FacilityBenefitShieldChargeRequestMessage(guid) =>
|
||||
guid mustEqual PlanetSideGUID(76)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = FacilityBenefitShieldChargeRequestMessage(PlanetSideGUID(76))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4,6 +4,7 @@ package game
|
|||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import net.psforever.types.LoadoutType
|
||||
import scodec.bits._
|
||||
|
||||
class FavoritesMessageTest extends Specification {
|
||||
|
|
@ -13,7 +14,7 @@ class FavoritesMessageTest extends Specification {
|
|||
"decode (for infantry)" in {
|
||||
PacketCoding.DecodePacket(stringInfantry).require match {
|
||||
case FavoritesMessage(list, player_guid, line, label, armor) =>
|
||||
list mustEqual 0
|
||||
list mustEqual LoadoutType.Infantry
|
||||
player_guid mustEqual PlanetSideGUID(3760)
|
||||
line mustEqual 0
|
||||
label mustEqual "Agile (basic)"
|
||||
|
|
@ -25,7 +26,7 @@ class FavoritesMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (for infantry)" in {
|
||||
val msg = FavoritesMessage(0, PlanetSideGUID(3760), 0, "Agile (basic)", Option(1))
|
||||
val msg = FavoritesMessage(LoadoutType.Infantry, PlanetSideGUID(3760), 0, "Agile (basic)", 1)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual stringInfantry
|
||||
|
|
@ -34,7 +35,7 @@ class FavoritesMessageTest extends Specification {
|
|||
"decode (for vehicles)" in {
|
||||
PacketCoding.DecodePacket(stringVehicles).require match {
|
||||
case FavoritesMessage(list, player_guid, line, label, armor) =>
|
||||
list mustEqual 1
|
||||
list mustEqual LoadoutType.Vehicle
|
||||
player_guid mustEqual PlanetSideGUID(4210)
|
||||
line mustEqual 0
|
||||
label mustEqual "Skyguard"
|
||||
|
|
@ -45,7 +46,7 @@ class FavoritesMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (for vehicles)" in {
|
||||
val msg = FavoritesMessage(1, PlanetSideGUID(4210), 0, "Skyguard")
|
||||
val msg = FavoritesMessage(LoadoutType.Vehicle, PlanetSideGUID(4210), 0, "Skyguard")
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual stringVehicles
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package game
|
|||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import net.psforever.types.LoadoutType
|
||||
import scodec.bits._
|
||||
|
||||
class FavoritesRequestTest extends Specification {
|
||||
|
|
@ -11,9 +12,9 @@ class FavoritesRequestTest extends Specification {
|
|||
|
||||
"decode (for infantry)" in {
|
||||
PacketCoding.DecodePacket(stringInfantry).require match {
|
||||
case FavoritesRequest(player_guid, unk, action, line, label) =>
|
||||
case FavoritesRequest(player_guid, list, action, line, label) =>
|
||||
player_guid mustEqual PlanetSideGUID(75)
|
||||
unk mustEqual 0
|
||||
list mustEqual LoadoutType.Infantry
|
||||
action mustEqual FavoritesAction.Save
|
||||
line mustEqual 1
|
||||
label.isDefined mustEqual true
|
||||
|
|
@ -24,7 +25,7 @@ class FavoritesRequestTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (for infantry)" in {
|
||||
val msg = FavoritesRequest(PlanetSideGUID(75), 0, FavoritesAction.Save, 1, Some("Example"))
|
||||
val msg = FavoritesRequest(PlanetSideGUID(75), LoadoutType.Infantry, FavoritesAction.Save, 1, Some("Example"))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual stringInfantry
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue