mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-20 23:23:35 +00:00
more tests for the proximity amenities; added the other silo in Anguta, Ceryshen and the terminal-facing silo in home3; initial work on FacilityBenefitShieldCharge packet and tests
This commit is contained in:
parent
a513f4996e
commit
e9aac5514a
18 changed files with 252 additions and 164 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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ class FavoritesMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode (for infantry)" in {
|
||||
val msg = FavoritesMessage(LoadoutType.Infantry, 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
|
||||
|
|
|
|||
|
|
@ -110,6 +110,42 @@ class LoadoutTest extends Specification {
|
|||
ldout1.subtype mustEqual 0
|
||||
ldout2.subtype mustEqual 1
|
||||
ldout3.subtype mustEqual 2
|
||||
ldout4.subtype mustEqual 3
|
||||
ldout4.subtype mustEqual InfantryLoadout.DetermineSubtype(player) //example
|
||||
}
|
||||
|
||||
"players have additional uniform subtype" in {
|
||||
val player = CreatePlayer()
|
||||
val slot = player.Slot(0)
|
||||
slot.Equipment = None //only an unequipped slot can have its Equipment Size changed (Rifle -> Max)
|
||||
|
||||
player.ExoSuit = ExoSuitType.Standard
|
||||
val ldout0 = Loadout.Create(player, "standard").asInstanceOf[InfantryLoadout]
|
||||
player.ExoSuit = ExoSuitType.Agile
|
||||
val ldout1 = Loadout.Create(player, "agile").asInstanceOf[InfantryLoadout]
|
||||
player.ExoSuit = ExoSuitType.Reinforced
|
||||
val ldout2 = Loadout.Create(player, "rein").asInstanceOf[InfantryLoadout]
|
||||
player.ExoSuit = ExoSuitType.Infiltration
|
||||
val ldout7 = Loadout.Create(player, "inf").asInstanceOf[InfantryLoadout]
|
||||
|
||||
Player.SuitSetup(player, ExoSuitType.MAX)
|
||||
val ldout3 = Loadout.Create(player, "weaponless").asInstanceOf[InfantryLoadout]
|
||||
slot.Equipment = None
|
||||
slot.Equipment = Tool(trhev_dualcycler)
|
||||
val ldout4 = Loadout.Create(player, "cycler").asInstanceOf[InfantryLoadout]
|
||||
slot.Equipment = None
|
||||
slot.Equipment = Tool(trhev_pounder)
|
||||
val ldout5 = Loadout.Create(player, "pounder").asInstanceOf[InfantryLoadout]
|
||||
slot.Equipment = None
|
||||
slot.Equipment = Tool(trhev_burster)
|
||||
val ldout6 = Loadout.Create(player, "burster").asInstanceOf[InfantryLoadout]
|
||||
|
||||
InfantryLoadout.DetermineSubtypeB(ldout0.exosuit, ldout0.subtype) mustEqual 0
|
||||
InfantryLoadout.DetermineSubtypeB(ldout1.exosuit, ldout1.subtype) mustEqual 1
|
||||
InfantryLoadout.DetermineSubtypeB(ldout2.exosuit, ldout2.subtype) mustEqual 2
|
||||
InfantryLoadout.DetermineSubtypeB(ldout3.exosuit, ldout3.subtype) mustEqual 3
|
||||
InfantryLoadout.DetermineSubtypeB(ldout4.exosuit, ldout4.subtype) mustEqual 4
|
||||
InfantryLoadout.DetermineSubtypeB(ldout5.exosuit, ldout5.subtype) mustEqual 5
|
||||
InfantryLoadout.DetermineSubtypeB(ldout6.exosuit, ldout6.subtype) mustEqual 6
|
||||
InfantryLoadout.DetermineSubtypeB(ldout7.exosuit, ldout7.subtype) mustEqual 7
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,25 +208,6 @@ class SpawnTubeObjectBuilderTest extends ActorTest {
|
|||
}
|
||||
}
|
||||
|
||||
class RepairRearmSiloObjectBuilderTest extends ActorTest {
|
||||
import net.psforever.objects.GlobalDefinitions.repair_silo
|
||||
import net.psforever.objects.serverobject.terminals.RepairRearmSilo
|
||||
"LockerObjectBuilder" should {
|
||||
"build" in {
|
||||
val hub = ServerObjectBuilderTest.NumberPoolHub
|
||||
val actor = system.actorOf(Props(classOf[ServerObjectBuilderTest.BuilderTestActor], ServerObjectBuilder(1,
|
||||
RepairRearmSilo.Constructor(repair_silo)), hub), "silo")
|
||||
actor ! "!"
|
||||
|
||||
val reply = receiveOne(Duration.create(1000, "ms"))
|
||||
assert(reply.isInstanceOf[RepairRearmSilo])
|
||||
assert(reply.asInstanceOf[RepairRearmSilo].HasGUID)
|
||||
assert(reply.asInstanceOf[RepairRearmSilo].GUID == PlanetSideGUID(1))
|
||||
assert(reply == hub(1).get)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object ServerObjectBuilderTest {
|
||||
import net.psforever.objects.guid.source.LimitedNumberSource
|
||||
def NumberPoolHub : NumberPoolHub = {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ package objects.terminal
|
|||
import akka.actor.ActorRef
|
||||
import net.psforever.objects.serverobject.structures.{Building, StructureType}
|
||||
import net.psforever.objects._
|
||||
import net.psforever.objects.serverobject.terminals.{RepairRearmSilo, Terminal}
|
||||
import net.psforever.objects.serverobject.terminals.Terminal
|
||||
import net.psforever.objects.zones.Zone
|
||||
import net.psforever.packet.game.{ItemTransactionMessage, PlanetSideGUID}
|
||||
import net.psforever.types.{CharacterGender, PlanetSideEmpire, TransactionType}
|
||||
|
|
@ -13,7 +13,7 @@ import org.specs2.mutable.Specification
|
|||
class RepairRearmSiloTest extends Specification {
|
||||
"RepairRearmSilo" should {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, 0))
|
||||
val silo = RepairRearmSilo(GlobalDefinitions.repair_silo)
|
||||
val silo = Terminal(GlobalDefinitions.repair_silo)
|
||||
silo.Owner = new Building(0, Zone.Nowhere, StructureType.Building)
|
||||
silo.Owner.Faction = PlanetSideEmpire.TR
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ class RepairRearmSiloTest extends Specification {
|
|||
}
|
||||
|
||||
"construct" in {
|
||||
val obj = RepairRearmSilo(GlobalDefinitions.repair_silo)
|
||||
val obj = Terminal(GlobalDefinitions.repair_silo)
|
||||
obj.Actor mustEqual ActorRef.noSender
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue