mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-28 00:09:13 +00:00
changing continent id and building id to normal data types in BroadcastWarpgateUpdate and BuildingInfoUpdate; implementing warp gates and branched logic for warp gate initialization in WSA; updating tests
This commit is contained in:
parent
f0bec9cf3a
commit
33a7636f5e
9 changed files with 176 additions and 83 deletions
|
|
@ -12,8 +12,8 @@ class BroadcastWarpgateUpdateMessageTest extends Specification {
|
|||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case BroadcastWarpgateUpdateMessage(continent_guid, building_guid, state1, state2, state3) =>
|
||||
continent_guid mustEqual PlanetSideGUID(13)
|
||||
building_guid mustEqual PlanetSideGUID(1)
|
||||
continent_guid mustEqual 13
|
||||
building_guid mustEqual 1
|
||||
state1 mustEqual false
|
||||
state2 mustEqual false
|
||||
state3 mustEqual true
|
||||
|
|
@ -23,7 +23,7 @@ class BroadcastWarpgateUpdateMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = BroadcastWarpgateUpdateMessage(PlanetSideGUID(13), PlanetSideGUID(1), false, false, true)
|
||||
val msg = BroadcastWarpgateUpdateMessage(13, 1, false, false, true)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
|
|
|
|||
|
|
@ -12,29 +12,29 @@ class BuildingInfoUpdateMessageTest extends Specification {
|
|||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case BuildingInfoUpdateMessage(continent_guid : PlanetSideGUID,
|
||||
building_guid : PlanetSideGUID,
|
||||
ntu_level : Int,
|
||||
is_hacked : Boolean,
|
||||
empire_hack : PlanetSideEmpire.Value,
|
||||
hack_time_remaining : Long,
|
||||
empire_own : PlanetSideEmpire.Value,
|
||||
unk1 : Long,
|
||||
unk1x : Option[Additional1],
|
||||
generator_state : PlanetSideGeneratorState.Value,
|
||||
spawn_tubes_normal : Boolean,
|
||||
force_dome_active : Boolean,
|
||||
lattice_benefit : Int,
|
||||
unk3 : Int,
|
||||
unk4 : List[Additional2],
|
||||
unk5 : Long,
|
||||
unk6 : Boolean,
|
||||
unk7 : Int,
|
||||
unk7x : Option[Additional3],
|
||||
boost_spawn_pain : Boolean,
|
||||
boost_generator_pain : Boolean) =>
|
||||
continent_guid mustEqual PlanetSideGUID(4)
|
||||
building_guid mustEqual PlanetSideGUID(9)
|
||||
case BuildingInfoUpdateMessage(continent_guid,
|
||||
building_guid,
|
||||
ntu_level,
|
||||
is_hacked,
|
||||
empire_hack,
|
||||
hack_time_remaining,
|
||||
empire_own,
|
||||
unk1,
|
||||
unk1x,
|
||||
generator_state,
|
||||
spawn_tubes_normal,
|
||||
force_dome_active,
|
||||
lattice_benefit,
|
||||
unk3,
|
||||
unk4,
|
||||
unk5,
|
||||
unk6,
|
||||
unk7,
|
||||
unk7x,
|
||||
boost_spawn_pain,
|
||||
boost_generator_pain) =>
|
||||
continent_guid mustEqual 4
|
||||
building_guid mustEqual 9
|
||||
ntu_level mustEqual 1
|
||||
is_hacked mustEqual false
|
||||
empire_hack mustEqual PlanetSideEmpire.NEUTRAL
|
||||
|
|
@ -61,8 +61,8 @@ class BuildingInfoUpdateMessageTest extends Specification {
|
|||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = BuildingInfoUpdateMessage(PlanetSideGUID(4),
|
||||
PlanetSideGUID(9),
|
||||
val msg = BuildingInfoUpdateMessage(4,
|
||||
9,
|
||||
1,
|
||||
false,
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import net.psforever.objects.GlobalDefinitions
|
|||
import net.psforever.objects.definition.ObjectDefinition
|
||||
import net.psforever.objects.serverobject.affinity.FactionAffinity
|
||||
import net.psforever.objects.serverobject.doors.{Door, DoorControl}
|
||||
import net.psforever.objects.serverobject.structures.{Amenity, Building, BuildingControl}
|
||||
import net.psforever.objects.serverobject.structures.{Amenity, Building, BuildingControl, WarpGate}
|
||||
import net.psforever.objects.zones.Zone
|
||||
import net.psforever.packet.game.PlanetSideGUID
|
||||
import net.psforever.types.PlanetSideEmpire
|
||||
|
|
@ -98,6 +98,19 @@ class BuildingTest extends Specification {
|
|||
}
|
||||
}
|
||||
|
||||
class WarpGateTest extends Specification {
|
||||
"WarpGate" should {
|
||||
"construct" in {
|
||||
val bldg = WarpGate(10, Zone.Nowhere)
|
||||
bldg.Id mustEqual 10
|
||||
bldg.Actor mustEqual ActorRef.noSender
|
||||
bldg.Amenities mustEqual Nil
|
||||
bldg.Zone mustEqual Zone.Nowhere
|
||||
bldg.Faction mustEqual PlanetSideEmpire.NEUTRAL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class BuildingControl1Test extends ActorTest {
|
||||
"Building Control" should {
|
||||
"construct" in {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects
|
||||
|
||||
import akka.actor.{Actor, Props}
|
||||
import akka.actor.{Actor, ActorContext, Props}
|
||||
import net.psforever.objects.guid.NumberPoolHub
|
||||
import net.psforever.packet.game.PlanetSideGUID
|
||||
import net.psforever.objects.serverobject.ServerObjectBuilder
|
||||
import net.psforever.objects.serverobject.structures.{Building, FoundationBuilder}
|
||||
import net.psforever.objects.serverobject.structures.{Building, FoundationBuilder, WarpGate}
|
||||
import net.psforever.objects.zones.Zone
|
||||
import net.psforever.types.Vector3
|
||||
|
||||
|
|
@ -14,7 +14,23 @@ import scala.concurrent.duration.Duration
|
|||
class BuildingBuilderTest extends ActorTest {
|
||||
"Building object" should {
|
||||
"build" in {
|
||||
val actor = system.actorOf(Props(classOf[ServerObjectBuilderTest.BuildingTestActor], 10, Zone.Nowhere), "building")
|
||||
val structure : (Int,Zone,ActorContext)=>Building = Building.Structure
|
||||
val actor = system.actorOf(Props(classOf[ServerObjectBuilderTest.BuildingTestActor], structure, 10, Zone.Nowhere), "building")
|
||||
actor ! "!"
|
||||
|
||||
val reply = receiveOne(Duration.create(1000, "ms"))
|
||||
assert(reply.isInstanceOf[Building])
|
||||
assert(reply.asInstanceOf[Building].Id == 10)
|
||||
assert(reply.asInstanceOf[Building].Zone == Zone.Nowhere)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class WarpGateBuilderTest extends ActorTest {
|
||||
"WarpGate object" should {
|
||||
"build" in {
|
||||
val structure : (Int,Zone,ActorContext)=>Building = WarpGate.Structure
|
||||
val actor = system.actorOf(Props(classOf[ServerObjectBuilderTest.BuildingTestActor], structure, 10, Zone.Nowhere), "wgate")
|
||||
actor ! "!"
|
||||
|
||||
val reply = receiveOne(Duration.create(1000, "ms"))
|
||||
|
|
@ -167,10 +183,10 @@ object ServerObjectBuilderTest {
|
|||
}
|
||||
}
|
||||
|
||||
class BuildingTestActor(building_id : Int, zone : Zone) extends Actor {
|
||||
class BuildingTestActor(structure_con : (Int,Zone,ActorContext)=>Building, building_id : Int, zone : Zone) extends Actor {
|
||||
def receive : Receive = {
|
||||
case _ =>
|
||||
sender ! FoundationBuilder(Building.Structure).Build(building_id, zone)(context)
|
||||
sender ! FoundationBuilder(structure_con).Build(building_id, zone)(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue