PSF-BotServer/common/src/test/scala/game/SpawnRequestMessageTest.scala

33 lines
793 B
Scala
Raw Normal View History

2018-03-01 10:39:34 -05:00
// Copyright (c) 2017 PSForever
package game
import org.specs2.mutable._
import net.psforever.packet._
import net.psforever.packet.game._
Damage Fix, and Stuff (#235) * redid splash damage radial degrade calculations; lasher damage fixed to 6/0 or 2/4 depending on armor; fixed direct hit distance for weapons that act like slash weapons; gave Falcon a valid projectile * delayed resource silo startup to avoid crash; discovered issue with MAX armor resulting from incorrect manipulation of inventory items during suit transfer * modifications to consider a specific modifier that exists on some vehicles and armored equipment called Subtract, a DamageProfile that reduces damage due to a set flag; manually controlling damage tick marks rather than relying only on HitHint (from client) * Tools now have default firemodes (temporary?); ammo gotten from loadouts is always full; loadouts and exo-suits juggle armor values differently on being changed; log messages for damage to players and vehicles * weapons with one (last) shot need support communicating that one (last) shot * fixing tests * correcting the codec for BindPlayerMessage * changed wording that identifies the damage log entries * switching exosuit no longer causes butterfingers * extending exosuit swap armor value changes to infantry loadout changes * ranges removed from non-vehicle containers * enabled partial damage functionality to facility turrets * BindPlayerMessage replacing BattleplanMessage for purposes of depicting the closest AMS spawn point; specific enums in relation to spawning in BPM and SpawnRequestMessage * rewrote exo-suit switching and loadout switching code, paying extra-special attention for the needs of MAX's * quick amendment for previous commit * switching from mount point check to seat checks in VehicleRemover; started refactoring of Cargo functions before realizing how complicated the full effort would be, so these changes are merely wrapping object identification by GUID * adding a minor server delay to terminal operations
2018-11-21 20:31:51 -05:00
import net.psforever.types.SpawnGroup
2018-03-01 10:39:34 -05:00
import scodec.bits._
class SpawnRequestMessageTest extends Specification {
val string = hex"4a000007000000000000000200"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case SpawnRequestMessage(unk1,unk2,unk3,unk4,unk5) =>
unk1 mustEqual 0
Damage Fix, and Stuff (#235) * redid splash damage radial degrade calculations; lasher damage fixed to 6/0 or 2/4 depending on armor; fixed direct hit distance for weapons that act like slash weapons; gave Falcon a valid projectile * delayed resource silo startup to avoid crash; discovered issue with MAX armor resulting from incorrect manipulation of inventory items during suit transfer * modifications to consider a specific modifier that exists on some vehicles and armored equipment called Subtract, a DamageProfile that reduces damage due to a set flag; manually controlling damage tick marks rather than relying only on HitHint (from client) * Tools now have default firemodes (temporary?); ammo gotten from loadouts is always full; loadouts and exo-suits juggle armor values differently on being changed; log messages for damage to players and vehicles * weapons with one (last) shot need support communicating that one (last) shot * fixing tests * correcting the codec for BindPlayerMessage * changed wording that identifies the damage log entries * switching exosuit no longer causes butterfingers * extending exosuit swap armor value changes to infantry loadout changes * ranges removed from non-vehicle containers * enabled partial damage functionality to facility turrets * BindPlayerMessage replacing BattleplanMessage for purposes of depicting the closest AMS spawn point; specific enums in relation to spawning in BPM and SpawnRequestMessage * rewrote exo-suit switching and loadout switching code, paying extra-special attention for the needs of MAX's * quick amendment for previous commit * switching from mount point check to seat checks in VehicleRemover; started refactoring of Cargo functions before realizing how complicated the full effort would be, so these changes are merely wrapping object identification by GUID * adding a minor server delay to terminal operations
2018-11-21 20:31:51 -05:00
unk2 mustEqual SpawnGroup.Facility
2018-03-01 10:39:34 -05:00
unk3 mustEqual 0
unk4 mustEqual 0
unk5 mustEqual 2
case _ =>
ko
}
}
"encode" in {
Damage Fix, and Stuff (#235) * redid splash damage radial degrade calculations; lasher damage fixed to 6/0 or 2/4 depending on armor; fixed direct hit distance for weapons that act like slash weapons; gave Falcon a valid projectile * delayed resource silo startup to avoid crash; discovered issue with MAX armor resulting from incorrect manipulation of inventory items during suit transfer * modifications to consider a specific modifier that exists on some vehicles and armored equipment called Subtract, a DamageProfile that reduces damage due to a set flag; manually controlling damage tick marks rather than relying only on HitHint (from client) * Tools now have default firemodes (temporary?); ammo gotten from loadouts is always full; loadouts and exo-suits juggle armor values differently on being changed; log messages for damage to players and vehicles * weapons with one (last) shot need support communicating that one (last) shot * fixing tests * correcting the codec for BindPlayerMessage * changed wording that identifies the damage log entries * switching exosuit no longer causes butterfingers * extending exosuit swap armor value changes to infantry loadout changes * ranges removed from non-vehicle containers * enabled partial damage functionality to facility turrets * BindPlayerMessage replacing BattleplanMessage for purposes of depicting the closest AMS spawn point; specific enums in relation to spawning in BPM and SpawnRequestMessage * rewrote exo-suit switching and loadout switching code, paying extra-special attention for the needs of MAX's * quick amendment for previous commit * switching from mount point check to seat checks in VehicleRemover; started refactoring of Cargo functions before realizing how complicated the full effort would be, so these changes are merely wrapping object identification by GUID * adding a minor server delay to terminal operations
2018-11-21 20:31:51 -05:00
val msg = SpawnRequestMessage(0, SpawnGroup.Facility, 0, 0, 2)
2018-03-01 10:39:34 -05:00
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}