mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-21 07:33:34 +00:00
partially-working vehicle favorites system; modifications to existing favorites system, identification of packet parameters
This commit is contained in:
parent
9d7d1b0456
commit
2a4fe4865e
15 changed files with 295 additions and 88 deletions
|
|
@ -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)", Option(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
|
||||
|
|
|
|||
|
|
@ -68,10 +68,10 @@ class OrderTerminalABTest extends Specification {
|
|||
player.ExoSuit = ExoSuitType.MAX
|
||||
avatar.SaveLoadout(player, "test2", 1)
|
||||
|
||||
val msg1 = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.InfantryLoadout, 4, "", 0, PlanetSideGUID(0))
|
||||
val msg1 = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Loadout, 4, "", 0, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg1) mustEqual Terminal.InfantryLoadout(ExoSuitType.Standard, 0, Nil, Nil)
|
||||
|
||||
val msg2 = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.InfantryLoadout, 4, "", 1, PlanetSideGUID(0))
|
||||
val msg2 = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Loadout, 4, "", 1, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg2) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue