PSF-LoginServer/src/test/scala/game/FavoritesMessageTest.scala
Fate-JH 6ae0b44848
Lump of Coal (#982)
* preliminary elements needed to battle frame robotics; mostly from previous branch

* introduction of FrameVehicleStateMessage and anticipated event system paths for BFR's; spawning amenities for BFR's are parsed and built from the zonemap files, but their coordinates are currently incorrect, and the resulting entity will not function atm

* bfr's spawn correctly; default arm weapons will spawn correctly; bfr rearm terminal added but arm swap not working correctly; bfr shields charge if not full; proper separation of vehicle spawn pad types

* arm weapon swapping in bfr's; swapped weapons switch, contextually, to either *_left or to *_right depending on the mounting; partial support for entities that do not have an OCDM packet form

* crouching improves shield regeneration

* some projectiles damage the bfr regardless of its shield

* delay the final vehicle explosion; start of vehicle subsystems

* handling for bfr shield ui updates; more of vehicle subsystems; corrections to TradeMessage packet; clarifications for FrameVehicleStateMessage package; report on flight status of bfr's

* control agency support for vehicle subsystems for arm weapon fire control

* vehicle capacitor, for what it's worth; shield and capacitor are influenced by recharge freeze and drain

* initial packet and tests for AvatarAwardMessage; update the fields of FreindsResponse, DetailedCharacterData, and LoadoutType for FavoritesMessage; corrections to intiailization packets in SessionActor; players start as imprinted by default

* support for GOAM and GAM integration into vehicle control agencies using a basic actor superclass; addition of vehicle subsystems; modifications to bfr control agency to allow for weapon handiness and subsystem control; fixed Fit mapping for vehicle override; made mountable seat transcoders independent

* delayed explosions to accompany the delayed death for the bfr; bfr terminal window closes on successful purchase

* the bfr armor siphon works

* clarification for bfr inventory item manipulation; corrections to length of bfr transcoder for flight variants; everything else in in support of the various arm weapons that can be assigned to the bfr, including damage proxy support for causing/interacting with/cleaning up after radiation cloud projectiles

* fixed the apc emp burst; fixed bfr arm weapon manipulation for activated subsystem; armor and ntu siphon support

* battleframe loadouts available upon vehicle spawn (vs and tr only)

* adb values for siphons; subsystem update message; some repairs

* cargo vehicles are subject to radiation damage; damage for battleframes are different depending on shield evasion status; battleframe loadout deleting supported; bfr kill box; automatically wire bfr sheds, includeing the ones in sanctuary

* proper bfr spawn angles; bfr vehicle timers; projectiles are no longer radiation clouds by default; better remote projectile cleanup; resolving incorrect weapon arm enabled states for bfrs

* added tests for FrameVehicleState and GenericObjectActionAtPosition; pass around maximum sector for zone interactions

* changed the triggers for the stamina regeneration timer

* potential fix for issue related to finding arm weapon mounts

* modifications to how vehicle subsystems are automated; jammer field updates; support and passing around custom block map ranges; does include activated dev tests for battleframe PAM, which will need to be stripped out later

* commit while working on subsystems mk2

* subsystems fail when jammed; an unoccupied bfr does not have shields active; pulling a bfr of one variant should block the other variant too

* fix distance check with radiation clouds; blocked bfr weaponry from anywhere but bfr arm mounts and cursor; ammunition depletion of aphelion laser; bfr shields deactivates when unoccupied

* significant modifications to vehicle subsystem operations; disambiguation of weapon subsystems; debuffs to charge rate and use rate for the capacitor and shield of bfr; test for ComponentDamageMessage; somewhat proper jammering operations for bfr
2022-01-27 09:57:51 -05:00

54 lines
1.7 KiB
Scala

// Copyright (c) 2017 PSForever
package game
import org.specs2.mutable._
import net.psforever.packet._
import net.psforever.packet.game._
import net.psforever.types.{LoadoutType, PlanetSideGUID}
import scodec.bits._
class FavoritesMessageTest extends Specification {
val stringVehicles = hex"60 5C 84 02 20 5300 6B00 7900 6700 7500 6100 7200 6400"
val stringInfantry = hex"60 2C 03 82 34 4100 6700 6900 6C00 6500 2000 2800 6200 6100 7300 6900 6300 2900 20"
"decode (for infantry)" in {
PacketCoding.decodePacket(stringInfantry).require match {
case FavoritesMessage(list, player_guid, line, label, armor) =>
list mustEqual LoadoutType.Infantry
player_guid mustEqual PlanetSideGUID(3760)
line mustEqual 0
label mustEqual "Agile (basic)"
armor.isDefined mustEqual true
armor.get mustEqual 1
case _ =>
ko
}
}
"encode (for infantry)" in {
val msg = FavoritesMessage.Infantry(PlanetSideGUID(3760), line = 0, label = "Agile (basic)", armor = 1)
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
pkt mustEqual stringInfantry
}
"decode (for vehicles)" in {
PacketCoding.decodePacket(stringVehicles).require match {
case FavoritesMessage(list, player_guid, line, label, armor) =>
list mustEqual LoadoutType.Vehicle
player_guid mustEqual PlanetSideGUID(4210)
line mustEqual 0
label mustEqual "Skyguard"
armor.isDefined mustEqual false
case _ =>
ko
}
}
"encode (for vehicles)" in {
val msg = FavoritesMessage.Vehicle(PlanetSideGUID(4210), line = 0, label = "Skyguard")
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
pkt mustEqual stringVehicles
}
}