mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-21 15:43:36 +00:00
ObjectCreateMessage Alterations, Class Object Adjustments (#243)
* power outage failure resulting in the destruction of the original ocm-fixes branch; the git branch refs were corrupted during commit, but the up-to-date changed files remained intact * eliminating the need for CommonFieldData2 and CommonFieldData2WithPlacement * in the middle of integrating CommonFieldData into DetailedLockerContainerData (but not standard LockerContainerData); added field for final boolean in WeaponData * adding faction affinity to Equipment (to match functionality; not becuase I know what ends ...) * in the middle of integrating CommonFieldData into DetailedCommandDetonaterData * applying faction affinity to objects at time of terminal production (but to what ends?); required BoomerTrigger and AmmoBox to always report as NEUTRAL internally * completed the transition from using the old class-based order terminal system to the page-based order terminal system; unused terminal classes have been eliminated * more closely aligned TelepadDeployableData and InternalTelepadDeployableData * modifying TelepadDeployableData make it generic and eliminate the need for InternalTelepadDeployableData after fixing a packet converter to utilize DroppedItemData * modified Terminal operation to branch further outwards from Terminal.Request to the TerminalDefinition's Request method; modified tests to reflect update * loosening up matrix terminal definition limitations * modified ProximityTerminal to support a custom defintition class * rendered the message passing system for Terminals general (Any) in the full scale so it can be specific in instance cases * refactored and moved both EquipmentSlot and ExoSuitDefinition * (re)load Favorites each time player (re)spawns
This commit is contained in:
parent
5fc9e191fe
commit
337cfbe5d2
174 changed files with 6281 additions and 5477 deletions
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects
|
||||
|
||||
import net.psforever.objects.equipment.EquipmentSize
|
||||
import net.psforever.objects.equipment.{EquipmentSize, EquipmentSlot}
|
||||
import net.psforever.objects.inventory.{Container, GridInventory, InventoryEquipmentSlot}
|
||||
import net.psforever.objects.{EquipmentSlot, GlobalDefinitions, OffhandEquipmentSlot, Tool}
|
||||
import net.psforever.objects.{GlobalDefinitions, OffhandEquipmentSlot, Tool}
|
||||
import net.psforever.packet.game.PlanetSideGUID
|
||||
import org.specs2.mutable._
|
||||
|
||||
|
|
|
|||
|
|
@ -25,13 +25,36 @@ class ConverterTest extends Specification {
|
|||
val obj = AmmoBox(bullet_9mm)
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual DetailedAmmoBoxData(8, 50)
|
||||
pkt mustEqual DetailedAmmoBoxData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
bops = false,
|
||||
alternate = false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
),
|
||||
obj.Capacity
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual AmmoBoxData()
|
||||
pkt mustEqual CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
bops = false,
|
||||
alternate = false,
|
||||
false,
|
||||
None,
|
||||
false,
|
||||
Some(false),
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -45,13 +68,23 @@ class ConverterTest extends Specification {
|
|||
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual DetailedWeaponData(4,8, Ammo.shotgun_shell.id, PlanetSideGUID(90), 0, DetailedAmmoBoxData(8, 12))
|
||||
pkt mustEqual DetailedWeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0)),
|
||||
0,
|
||||
List(InternalSlot(Ammo.shotgun_shell.id, PlanetSideGUID(90), 0, DetailedAmmoBoxData(8, 12)))
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual WeaponData(4,8, 0, Ammo.shotgun_shell.id, PlanetSideGUID(90), 0, AmmoBoxData())
|
||||
pkt mustEqual WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0)),
|
||||
0,
|
||||
List(InternalSlot(Ammo.shotgun_shell.id, PlanetSideGUID(90), 0,
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, false, None, false, Some(false), None, PlanetSideGUID(0)))
|
||||
)
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -64,7 +97,9 @@ class ConverterTest extends Specification {
|
|||
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual DetailedWeaponData(4,8, 0,
|
||||
pkt mustEqual DetailedWeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0)),
|
||||
0,
|
||||
List(
|
||||
InternalSlot(Ammo.bullet_9mm.id, PlanetSideGUID(90), 0, DetailedAmmoBoxData(8, 30)),
|
||||
InternalSlot(Ammo.rocket.id, PlanetSideGUID(91), 1, DetailedAmmoBoxData(8, 1))
|
||||
|
|
@ -75,10 +110,22 @@ class ConverterTest extends Specification {
|
|||
}
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual WeaponData(4,8, 0,
|
||||
pkt mustEqual WeaponData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL, //TODO need faction affinity
|
||||
bops = false,
|
||||
alternate = false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
),
|
||||
0,
|
||||
List(
|
||||
InternalSlot(Ammo.bullet_9mm.id, PlanetSideGUID(90), 0, AmmoBoxData()),
|
||||
InternalSlot(Ammo.rocket.id, PlanetSideGUID(91), 1, AmmoBoxData())
|
||||
InternalSlot(Ammo.bullet_9mm.id, PlanetSideGUID(90), 0, CommonFieldData()(false)),
|
||||
InternalSlot(Ammo.rocket.id, PlanetSideGUID(91), 1, CommonFieldData()(false))
|
||||
)
|
||||
)
|
||||
case _ =>
|
||||
|
|
@ -100,7 +147,7 @@ class ConverterTest extends Specification {
|
|||
}
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual AmmoBoxData()
|
||||
pkt mustEqual CommonFieldData()(false)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -112,14 +159,28 @@ class ConverterTest extends Specification {
|
|||
obj.GUID = PlanetSideGUID(90)
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual DetailedACEData(0)
|
||||
pkt mustEqual DetailedConstructionToolData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual ACEData(0,0)
|
||||
pkt mustEqual HandheldData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
)
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -135,13 +196,37 @@ class ConverterTest extends Specification {
|
|||
obj.GUID = PlanetSideGUID(90)
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual DetailedREKData(8)
|
||||
pkt mustEqual DetailedREKData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL, //TODO faction affinity
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
Some(false),
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
)
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual REKData(8,0)
|
||||
pkt mustEqual REKData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
Some(false),
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
)
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -154,13 +239,17 @@ class ConverterTest extends Specification {
|
|||
obj.GUID = PlanetSideGUID(90)
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual DetailedBoomerTriggerData()
|
||||
pkt mustEqual DetailedConstructionToolData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual BoomerTriggerData()
|
||||
pkt mustEqual HandheldData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, false, None, false, None, None, PlanetSideGUID(0))
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -173,14 +262,28 @@ class ConverterTest extends Specification {
|
|||
obj.Router = PlanetSideGUID(1001)
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual TelepadData(0, PlanetSideGUID(1001))
|
||||
pkt mustEqual HandheldData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
Some(1001),
|
||||
PlanetSideGUID(0)
|
||||
)
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual DetailedTelepadData(0, PlanetSideGUID(1001))
|
||||
pkt mustEqual DetailedConstructionToolData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, Some(1001), PlanetSideGUID(0))
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -204,12 +307,19 @@ class ConverterTest extends Specification {
|
|||
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual SmallDeployableData(
|
||||
pkt mustEqual CommonFieldDataWithPlacement(
|
||||
PlacementData(Vector3.Zero, Vector3.Zero),
|
||||
PlanetSideEmpire.TR,
|
||||
0,
|
||||
false,
|
||||
false
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.TR,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
None,
|
||||
false,
|
||||
Some(false),
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
)
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
|
|
@ -229,17 +339,20 @@ class ConverterTest extends Specification {
|
|||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual SmallTurretData(
|
||||
SmallDeployableData(
|
||||
CommonFieldDataWithPlacement(
|
||||
PlacementData(Vector3.Zero, Vector3.Zero),
|
||||
PlanetSideEmpire.TR,
|
||||
0,
|
||||
false,
|
||||
false
|
||||
CommonFieldData(PlanetSideEmpire.TR, false, false, false, None, false, Some(true), None, PlanetSideGUID(0))
|
||||
),
|
||||
255,
|
||||
InventoryData(
|
||||
List(InternalSlot(ObjectClass.spitfire_weapon, PlanetSideGUID(91), 1,
|
||||
WeaponData(4, 8, ObjectClass.spitfire_ammo, PlanetSideGUID(92), 0, AmmoBoxData()))
|
||||
WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0)),
|
||||
0,
|
||||
List(InternalSlot(Ammo.spitfire_ammo.id, PlanetSideGUID(92), 0,
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, false, None, false, Some(false), None, PlanetSideGUID(0)))
|
||||
))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -261,17 +374,20 @@ class ConverterTest extends Specification {
|
|||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual OneMannedFieldTurretData(
|
||||
SmallDeployableData(
|
||||
CommonFieldDataWithPlacement(
|
||||
PlacementData(Vector3.Zero, Vector3.Zero),
|
||||
PlanetSideEmpire.TR,
|
||||
0,
|
||||
false,
|
||||
false
|
||||
CommonFieldData(PlanetSideEmpire.TR, false, false, true, None, false, Some(false), None, PlanetSideGUID(0))
|
||||
),
|
||||
255,
|
||||
InventoryData(
|
||||
List(InternalSlot(ObjectClass.energy_gun_tr, PlanetSideGUID(91), 1,
|
||||
WeaponData(4, 8, ObjectClass.energy_gun_ammo, PlanetSideGUID(92), 0, AmmoBoxData()))
|
||||
WeaponData(
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0)),
|
||||
0,
|
||||
List(InternalSlot(Ammo.energy_gun_ammo.id, PlanetSideGUID(92), 0,
|
||||
CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, false, None, false, Some(false), None, PlanetSideGUID(0)))
|
||||
))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -291,12 +407,19 @@ class ConverterTest extends Specification {
|
|||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual TRAPData(
|
||||
SmallDeployableData(
|
||||
CommonFieldDataWithPlacement(
|
||||
PlacementData(Vector3.Zero, Vector3.Zero),
|
||||
PlanetSideEmpire.TR,
|
||||
0,
|
||||
false,
|
||||
false
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.TR,
|
||||
bops = false,
|
||||
alternate = false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
Some(true),
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
)
|
||||
),
|
||||
255
|
||||
)
|
||||
|
|
@ -316,7 +439,7 @@ class ConverterTest extends Specification {
|
|||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual AegisShieldGeneratorData(
|
||||
CommonFieldData(
|
||||
CommonFieldDataWithPlacement(
|
||||
PlacementData(Vector3.Zero, Vector3.Zero),
|
||||
PlanetSideEmpire.TR,
|
||||
0
|
||||
|
|
@ -339,15 +462,23 @@ class ConverterTest extends Specification {
|
|||
obj.Health = 1
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual TelepadDeployableData(
|
||||
pkt mustEqual DroppedItemData(
|
||||
PlacementData(Vector3.Zero, Vector3.Zero),
|
||||
PlanetSideEmpire.TR,
|
||||
bops = false,
|
||||
destroyed = false,
|
||||
unk1 = 2, unk2 = true,
|
||||
router_guid = PlanetSideGUID(1001),
|
||||
owner_guid = PlanetSideGUID(5001),
|
||||
unk3 = 87, unk4 = 12
|
||||
TelepadDeployableData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.TR,
|
||||
bops = false,
|
||||
alternate = false,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
Some(1001),
|
||||
PlanetSideGUID(5001)
|
||||
),
|
||||
unk1 = 87,
|
||||
unk2 = 12
|
||||
)
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
|
|
@ -363,15 +494,23 @@ class ConverterTest extends Specification {
|
|||
obj.Health = 0
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual TelepadDeployableData(
|
||||
pkt mustEqual DroppedItemData(
|
||||
PlacementData(Vector3.Zero, Vector3.Zero),
|
||||
PlanetSideEmpire.TR,
|
||||
bops = false,
|
||||
destroyed = true,
|
||||
unk1 = 2, unk2 = true,
|
||||
router_guid = PlanetSideGUID(1001),
|
||||
owner_guid = PlanetSideGUID(0),
|
||||
unk3 = 0, unk4 = 6
|
||||
TelepadDeployableData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.TR,
|
||||
bops = false,
|
||||
alternate = true,
|
||||
true,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
Some(1001),
|
||||
PlanetSideGUID(0)
|
||||
),
|
||||
unk1 = 0,
|
||||
unk2 = 6
|
||||
)
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
|
|
@ -496,13 +635,13 @@ class ConverterTest extends Specification {
|
|||
val obj = LockerContainer()
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual DetailedLockerContainerData(8, None)
|
||||
pkt mustEqual DetailedLockerContainerData(CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, None, None, PlanetSideGUID(0)), None)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual LockerContainerData(InventoryData(List.empty))
|
||||
pkt mustEqual LockerContainerData(None)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -517,13 +656,13 @@ class ConverterTest extends Specification {
|
|||
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual DetailedLockerContainerData(8, InternalSlot(remote_electronics_kit.ObjectId, PlanetSideGUID(1), 0, DetailedREKData(8)) :: Nil)
|
||||
pkt mustEqual DetailedLockerContainerData(8, InternalSlot(remote_electronics_kit.ObjectId, PlanetSideGUID(1), 0, DetailedREKData(CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, Some(false), None, PlanetSideGUID(0)))) :: Nil)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual LockerContainerData(InventoryData(InternalSlot(remote_electronics_kit.ObjectId, PlanetSideGUID(1), 0, REKData(8,0)) :: Nil))
|
||||
pkt mustEqual LockerContainerData(InventoryData(InternalSlot(remote_electronics_kit.ObjectId, PlanetSideGUID(1), 0, REKData(CommonFieldData(PlanetSideEmpire.NEUTRAL, false, false, true, None, false, Some(false), None, PlanetSideGUID(0)))) :: Nil))
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -543,7 +682,7 @@ class ConverterTest extends Specification {
|
|||
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual CommonTerminalData(PlanetSideEmpire.NEUTRAL)
|
||||
pkt mustEqual CommonFieldData(PlanetSideEmpire.NEUTRAL)(false)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -563,7 +702,7 @@ class ConverterTest extends Specification {
|
|||
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual CommonTerminalData(PlanetSideEmpire.NEUTRAL)
|
||||
pkt mustEqual CommonFieldData(PlanetSideEmpire.NEUTRAL)(false)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects
|
||||
|
||||
import net.psforever.objects.{EquipmentSlot, OffhandEquipmentSlot, Tool}
|
||||
import net.psforever.objects.equipment.EquipmentSize
|
||||
import net.psforever.objects.{OffhandEquipmentSlot, Tool}
|
||||
import net.psforever.objects.equipment.{EquipmentSize, EquipmentSlot}
|
||||
import net.psforever.objects.GlobalDefinitions.{beamer, repeater, suppressor}
|
||||
import org.specs2.mutable._
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects
|
||||
|
||||
import net.psforever.objects._
|
||||
import net.psforever.objects.definition.{ExoSuitDefinition, SpecialExoSuitDefinition}
|
||||
import net.psforever.objects.equipment._
|
||||
import net.psforever.objects.inventory.InventoryTile
|
||||
import net.psforever.types.ExoSuitType
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ package objects
|
|||
|
||||
import net.psforever.objects.GlobalDefinitions._
|
||||
import net.psforever.objects._
|
||||
import net.psforever.objects.definition.{ImplantDefinition, SimpleItemDefinition}
|
||||
import net.psforever.objects.definition.{ImplantDefinition, SimpleItemDefinition, SpecialExoSuitDefinition}
|
||||
import net.psforever.objects.equipment.EquipmentSize
|
||||
import net.psforever.packet.game.PlanetSideGUID
|
||||
import net.psforever.packet.game.objectcreate.{Cosmetics, PersonalStyle}
|
||||
import net.psforever.types._
|
||||
import org.specs2.mutable._
|
||||
|
||||
|
|
@ -521,6 +522,115 @@ class PlayerTest extends Specification {
|
|||
obj.UsingSpecial != test mustEqual true
|
||||
}
|
||||
|
||||
"start with a nonexistent cosmetic state" in {
|
||||
TestPlayer("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5).PersonalStyleFeatures.isEmpty mustEqual true
|
||||
}
|
||||
|
||||
"will not gain cosmetic state if player does not have a certain amount of BEP" in {
|
||||
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
|
||||
val obj = Player(avatar)
|
||||
obj.PersonalStyleFeatures.isEmpty mustEqual true
|
||||
val (a1, b1) = obj.AddToPersonalStyle(PersonalStyle.Beret)
|
||||
a1.isEmpty mustEqual true
|
||||
b1.isEmpty mustEqual true
|
||||
obj.PersonalStyleFeatures.isEmpty mustEqual true
|
||||
|
||||
avatar.BEP = 2286231 //BR24
|
||||
val (a2, b2) = obj.AddToPersonalStyle(PersonalStyle.Beret)
|
||||
a2.isEmpty mustEqual true
|
||||
b2 match {
|
||||
case Some(c : Cosmetics) =>
|
||||
c.Styles mustEqual Set(PersonalStyle.Beret)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
obj.PersonalStyleFeatures.isEmpty mustEqual false
|
||||
}
|
||||
|
||||
"will lose cosmetic state" in {
|
||||
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
|
||||
val obj = Player(avatar)
|
||||
avatar.BEP = 2286231 //BR24
|
||||
obj.AddToPersonalStyle(PersonalStyle.Beret)
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Beret))) mustEqual true
|
||||
val (a2, b2) = obj.RemoveFromPersonalStyle(PersonalStyle.Beret)
|
||||
a2 match {
|
||||
case Some(c : Cosmetics) =>
|
||||
c.Styles mustEqual Set(PersonalStyle.Beret)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
b2 match {
|
||||
case Some(c : Cosmetics) =>
|
||||
c.Styles mustEqual Set.empty
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"will not lose cosmetic state if the player doesn't have any cosmetic state to begin with" in {
|
||||
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
|
||||
val obj = Player(avatar)
|
||||
obj.PersonalStyleFeatures.isEmpty mustEqual true
|
||||
val (a1, b1) = obj.RemoveFromPersonalStyle(PersonalStyle.Beret)
|
||||
a1.isEmpty mustEqual true
|
||||
b1.isEmpty mustEqual true
|
||||
}
|
||||
|
||||
"toggle helmet" in {
|
||||
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
|
||||
val obj = Player(avatar)
|
||||
avatar.BEP = 2286231
|
||||
obj.PersonalStyleFeatures.isEmpty mustEqual true
|
||||
obj.ToggleHelmet
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.NoHelmet))) mustEqual true
|
||||
obj.ToggleHelmet
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics()) mustEqual true
|
||||
obj.ToggleHelmet
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.NoHelmet))) mustEqual true
|
||||
}
|
||||
|
||||
"toggle suglasses" in {
|
||||
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
|
||||
val obj = Player(avatar)
|
||||
avatar.BEP = 2286231
|
||||
obj.PersonalStyleFeatures.isEmpty mustEqual true
|
||||
obj.ToggleShades
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Sunglasses))) mustEqual true
|
||||
obj.ToggleShades
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics()) mustEqual true
|
||||
obj.ToggleShades
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Sunglasses))) mustEqual true
|
||||
}
|
||||
|
||||
"toggle earpiece" in {
|
||||
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
|
||||
val obj = Player(avatar)
|
||||
avatar.BEP = 2286231
|
||||
obj.PersonalStyleFeatures.isEmpty mustEqual true
|
||||
obj.ToggleEarpiece
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Earpiece))) mustEqual true
|
||||
obj.ToggleEarpiece
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics()) mustEqual true
|
||||
obj.ToggleEarpiece
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Earpiece))) mustEqual true
|
||||
}
|
||||
|
||||
"toggle between brimmed cap and beret" in {
|
||||
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
|
||||
val obj = Player(avatar)
|
||||
avatar.BEP = 2286231
|
||||
obj.PersonalStyleFeatures.isEmpty mustEqual true
|
||||
obj.ToggleHat
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.BrimmedCap))) mustEqual true
|
||||
obj.ToggleHat
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Beret))) mustEqual true
|
||||
obj.ToggleHat
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics()) mustEqual true
|
||||
obj.ToggleHat
|
||||
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.BrimmedCap))) mustEqual true
|
||||
}
|
||||
|
||||
"toString" in {
|
||||
val obj = TestPlayer("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
|
||||
obj.toString mustEqual "TR Chord 0/100 0/50"
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class UtilityTest extends Specification {
|
|||
obj().Owner = veh //hack
|
||||
obj().GUID = PlanetSideGUID(1)
|
||||
|
||||
val msg = obj().asInstanceOf[Terminal].Buy(
|
||||
val msg = obj().asInstanceOf[Terminal].Request(
|
||||
Player(Avatar("TestCharacter", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute)),
|
||||
ItemTransactionMessage(PlanetSideGUID(853), TransactionType.Buy, 0, "router_telepad", 0, PlanetSideGUID(0))
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects.terminal
|
||||
|
||||
import akka.actor.ActorRef
|
||||
import net.psforever.objects.serverobject.structures.{Building, StructureType}
|
||||
import net.psforever.objects.{Avatar, GlobalDefinitions, Player}
|
||||
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, CharacterVoice, PlanetSideEmpire, TransactionType}
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
class AirVehicleTerminalTest extends Specification {
|
||||
"Air_Vehicle_Terminal" should {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
||||
val terminal = Terminal(GlobalDefinitions.air_vehicle_terminal)
|
||||
terminal.Owner = new Building(0, Zone.Nowhere, StructureType.Building)
|
||||
terminal.Owner.Faction = PlanetSideEmpire.TR
|
||||
|
||||
"construct" in {
|
||||
val terminal = Terminal(GlobalDefinitions.air_vehicle_terminal)
|
||||
terminal.Actor mustEqual ActorRef.noSender
|
||||
}
|
||||
|
||||
"player can buy a reaver ('lightgunship')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "lightgunship", 0, PlanetSideGUID(0))
|
||||
|
||||
val reply = terminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.BuyVehicle] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.BuyVehicle]
|
||||
reply2.vehicle.Definition mustEqual GlobalDefinitions.lightgunship
|
||||
reply2.weapons mustEqual Nil
|
||||
reply2.inventory.length mustEqual 6
|
||||
reply2.inventory.head.obj.Definition mustEqual GlobalDefinitions.reaver_rocket
|
||||
reply2.inventory(1).obj.Definition mustEqual GlobalDefinitions.reaver_rocket
|
||||
reply2.inventory(2).obj.Definition mustEqual GlobalDefinitions.reaver_rocket
|
||||
reply2.inventory(3).obj.Definition mustEqual GlobalDefinitions.reaver_rocket
|
||||
reply2.inventory(4).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(5).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
}
|
||||
|
||||
"player can not buy a fake vehicle ('reaver')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "reaver", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects.terminal
|
||||
|
||||
import akka.actor.ActorRef
|
||||
import net.psforever.objects.serverobject.structures.{Building, StructureType}
|
||||
import net.psforever.objects.serverobject.terminals.Terminal
|
||||
import net.psforever.objects.zones.Zone
|
||||
import net.psforever.objects.{Avatar, GlobalDefinitions, Player}
|
||||
import net.psforever.packet.game.{ItemTransactionMessage, PlanetSideGUID}
|
||||
import net.psforever.types._
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
class CertTerminalTest extends Specification {
|
||||
"Cert_Terminal" should {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
||||
val terminal = Terminal(GlobalDefinitions.cert_terminal)
|
||||
terminal.Owner = new Building(0, Zone.Nowhere, StructureType.Building)
|
||||
terminal.Owner.Faction = PlanetSideEmpire.TR
|
||||
|
||||
"construct" in {
|
||||
val terminal = Terminal(GlobalDefinitions.cert_terminal)
|
||||
terminal.Actor mustEqual ActorRef.noSender
|
||||
}
|
||||
|
||||
"player can learn a certification ('medium_assault')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Learn, 0, "medium_assault", 0, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg) mustEqual Terminal.LearnCertification(CertificationType.MediumAssault)
|
||||
}
|
||||
|
||||
"player can not learn a fake certification ('juggling')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Learn, 0, "juggling", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
|
||||
"player can forget a certification ('medium_assault')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Sell, 0, "medium_assault", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.SellCertification(CertificationType.MediumAssault)
|
||||
}
|
||||
|
||||
"player can not forget a fake certification ('juggling')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Sell, 0, "juggling", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects.terminal
|
||||
|
||||
import akka.actor.ActorRef
|
||||
import net.psforever.objects.serverobject.structures.{Building, StructureType}
|
||||
import net.psforever.objects.{Avatar, GlobalDefinitions, Player}
|
||||
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, CharacterVoice, PlanetSideEmpire, TransactionType}
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
class DropshipVehicleTerminalTest extends Specification {
|
||||
"Dropship_Vehicle_Terminal" should {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
||||
val terminal = Terminal(GlobalDefinitions.dropship_vehicle_terminal)
|
||||
terminal.Owner = new Building(0, Zone.Nowhere, StructureType.Building)
|
||||
terminal.Owner.Faction = PlanetSideEmpire.TR
|
||||
|
||||
"construct" in {
|
||||
val terminal = Terminal(GlobalDefinitions.dropship_vehicle_terminal)
|
||||
terminal.Actor mustEqual ActorRef.noSender
|
||||
}
|
||||
|
||||
"player can buy a galaxy ('dropship')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "dropship", 0, PlanetSideGUID(0))
|
||||
|
||||
val reply = terminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.BuyVehicle] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.BuyVehicle]
|
||||
reply2.vehicle.Definition mustEqual GlobalDefinitions.dropship
|
||||
reply2.weapons mustEqual Nil
|
||||
reply2.inventory.length mustEqual 12
|
||||
reply2.inventory.head.obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(1).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(2).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(3).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(4).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(5).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(6).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(7).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(8).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(9).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(10).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(11).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
}
|
||||
|
||||
"player can not buy a fake vehicle ('galaxy')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "galaxy", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects.terminal
|
||||
|
||||
import akka.actor.ActorRef
|
||||
import net.psforever.objects.serverobject.structures.{Building, StructureType}
|
||||
import net.psforever.objects.{Avatar, GlobalDefinitions, Player}
|
||||
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, CharacterVoice, PlanetSideEmpire, TransactionType}
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
class GroundVehicleTerminalTest extends Specification {
|
||||
"Ground_Vehicle_Terminal" should {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
||||
val terminal = Terminal(GlobalDefinitions.ground_vehicle_terminal)
|
||||
terminal.Owner = new Building(0, Zone.Nowhere, StructureType.Building)
|
||||
terminal.Owner.Faction = PlanetSideEmpire.TR
|
||||
|
||||
"construct" in {
|
||||
val terminal = Terminal(GlobalDefinitions.ground_vehicle_terminal)
|
||||
terminal.Actor mustEqual ActorRef.noSender
|
||||
}
|
||||
|
||||
"player can buy a harasser ('two_man_assault_buggy')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "two_man_assault_buggy", 0, PlanetSideGUID(0))
|
||||
|
||||
val reply = terminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.BuyVehicle] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.BuyVehicle]
|
||||
reply2.vehicle.Definition mustEqual GlobalDefinitions.two_man_assault_buggy
|
||||
reply2.weapons mustEqual Nil
|
||||
reply2.inventory.length mustEqual 6
|
||||
reply2.inventory.head.obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
reply2.inventory(1).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
reply2.inventory(2).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
reply2.inventory(3).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
reply2.inventory(4).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
reply2.inventory(5).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
}
|
||||
|
||||
"player can not buy a fake vehicle ('harasser')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "harasser", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects.terminal
|
||||
|
||||
import akka.actor.ActorRef
|
||||
import net.psforever.objects.serverobject.structures.{Building, StructureType}
|
||||
import net.psforever.objects.{Avatar, GlobalDefinitions, Player}
|
||||
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, CharacterVoice, PlanetSideEmpire, TransactionType}
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
class ImplantTerminalInterfaceTest extends Specification {
|
||||
"Implant_Terminal_Interface" should {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
||||
val terminal = Terminal(GlobalDefinitions.implant_terminal_interface)
|
||||
terminal.Owner = new Building(0, Zone.Nowhere, StructureType.Building)
|
||||
terminal.Owner.Faction = PlanetSideEmpire.TR
|
||||
|
||||
"construct" in {
|
||||
val terminal = Terminal(GlobalDefinitions.implant_terminal_interface)
|
||||
terminal.Actor mustEqual ActorRef.noSender
|
||||
}
|
||||
|
||||
"player can learn an implant ('darklight_vision')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "darklight_vision", 0, PlanetSideGUID(0))
|
||||
|
||||
val reply = terminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.LearnImplant] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.LearnImplant]
|
||||
reply2.implant mustEqual GlobalDefinitions.darklight_vision
|
||||
}
|
||||
|
||||
"player can not learn a fake implant ('aimbot')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "aimbot", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
|
||||
"player can surrender an implant ('darklight_vision')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Sell, 0, "darklight_vision", 0, PlanetSideGUID(0))
|
||||
|
||||
val reply = terminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.SellImplant] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.SellImplant]
|
||||
reply2.implant mustEqual GlobalDefinitions.darklight_vision
|
||||
}
|
||||
|
||||
"player can not surrender a fake implant ('aimbot')" in {
|
||||
val terminal = Terminal(GlobalDefinitions.implant_terminal_interface)
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Sell, 0, "aimbot", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ class ImplantTerminalMechTest extends Specification {
|
|||
}
|
||||
}
|
||||
|
||||
"VehicleSpawnPad" should {
|
||||
"Implant_Terminal_Mech" should {
|
||||
"construct" in {
|
||||
val obj = ImplantTerminalMech(GlobalDefinitions.implant_terminal_mech)
|
||||
obj.Actor mustEqual ActorRef.noSender
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects.terminal
|
||||
|
||||
import akka.actor.ActorRef
|
||||
import net.psforever.objects.serverobject.terminals.{MatrixTerminalDefinition, Terminal}
|
||||
import net.psforever.objects.{Avatar, GlobalDefinitions, Player, Vehicle}
|
||||
import net.psforever.packet.game.{ItemTransactionMessage, PlanetSideGUID}
|
||||
|
|
@ -10,59 +9,22 @@ import org.specs2.mutable.Specification
|
|||
|
||||
class MatrixTerminalTest extends Specification {
|
||||
"MatrixTerminal" should {
|
||||
"define (a)" in {
|
||||
"define" in {
|
||||
val a = new MatrixTerminalDefinition(517)
|
||||
a.ObjectId mustEqual 517
|
||||
a.Name mustEqual "matrix_terminala"
|
||||
}
|
||||
|
||||
"define (b)" in {
|
||||
val b = new MatrixTerminalDefinition(518)
|
||||
b.ObjectId mustEqual 518
|
||||
b.Name mustEqual "matrix_terminalb"
|
||||
"creation" in {
|
||||
Terminal(new MatrixTerminalDefinition(518))
|
||||
ok
|
||||
}
|
||||
|
||||
"define (c)" in {
|
||||
val b = new MatrixTerminalDefinition(519)
|
||||
b.ObjectId mustEqual 519
|
||||
b.Name mustEqual "matrix_terminalc"
|
||||
}
|
||||
|
||||
"define (d)" in {
|
||||
val b = new MatrixTerminalDefinition(812)
|
||||
b.ObjectId mustEqual 812
|
||||
b.Name mustEqual "spawn_terminal"
|
||||
}
|
||||
|
||||
"define (invalid)" in {
|
||||
var id : Int = (math.random * Int.MaxValue).toInt
|
||||
if(id == 517) {
|
||||
id += 3
|
||||
}
|
||||
else if(id == 518) {
|
||||
id += 2
|
||||
}
|
||||
else if(id == 519 | id == 812) {
|
||||
id += 1
|
||||
}
|
||||
|
||||
new MatrixTerminalDefinition(id) must throwA[IllegalArgumentException]
|
||||
}
|
||||
}
|
||||
|
||||
"Matrix_Terminal" should {
|
||||
val terminal = Terminal(GlobalDefinitions.matrix_terminalc)
|
||||
terminal.Owner = Vehicle(GlobalDefinitions.quadstealth)
|
||||
terminal.Owner.Faction = PlanetSideEmpire.TR
|
||||
|
||||
"construct" in {
|
||||
terminal.Actor mustEqual ActorRef.noSender
|
||||
}
|
||||
|
||||
"player can not buy (anything)" in {
|
||||
"invalid message" in {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 1, "lite_armor", 0, PlanetSideGUID(0))
|
||||
|
||||
val terminal = Terminal(new MatrixTerminalDefinition(519))
|
||||
terminal.Owner = Vehicle(GlobalDefinitions.quadstealth)
|
||||
terminal.Owner.Faction = PlanetSideEmpire.TR
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects.terminal
|
||||
|
||||
import akka.actor.ActorRef
|
||||
import net.psforever.objects.serverobject.structures.{Building, StructureType}
|
||||
import net.psforever.objects.serverobject.terminals.{OrderTerminalABDefinition, Terminal}
|
||||
import net.psforever.objects.zones.Zone
|
||||
import net.psforever.objects.{Avatar, GlobalDefinitions, Player}
|
||||
import net.psforever.packet.game.{ItemTransactionMessage, PlanetSideGUID}
|
||||
import net.psforever.types._
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
class OrderTerminalABTest extends Specification {
|
||||
"OrderTerminalAB" should {
|
||||
"define (a)" in {
|
||||
val a = new OrderTerminalABDefinition(613)
|
||||
a.ObjectId mustEqual 613
|
||||
a.Name mustEqual "order_terminala"
|
||||
}
|
||||
|
||||
"define (b)" in {
|
||||
val b = new OrderTerminalABDefinition(614)
|
||||
b.ObjectId mustEqual 614
|
||||
b.Name mustEqual "order_terminalb"
|
||||
}
|
||||
|
||||
"define (invalid)" in {
|
||||
var id : Int = (math.random * Int.MaxValue).toInt
|
||||
if(id == 613) {
|
||||
id += 2
|
||||
}
|
||||
else if(id == 614) {
|
||||
id += 1
|
||||
}
|
||||
|
||||
new OrderTerminalABDefinition(id) must throwA[IllegalArgumentException]
|
||||
}
|
||||
}
|
||||
|
||||
"Order_Terminal" should {
|
||||
val terminal = Terminal(GlobalDefinitions.order_terminala)
|
||||
terminal.Owner = new Building(0, Zone.Nowhere, StructureType.Building)
|
||||
terminal.Owner.Faction = PlanetSideEmpire.TR
|
||||
|
||||
"construct" in {
|
||||
terminal.Actor mustEqual ActorRef.noSender
|
||||
}
|
||||
|
||||
"player can buy different armor ('lite_armor')" in {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 1, "lite_armor", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.BuyExosuit(ExoSuitType.Agile)
|
||||
}
|
||||
|
||||
"player can buy max armor ('trhev_antiaircraft')" in {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 1, "trhev_antiaircraft", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
//TODO loudout tests
|
||||
|
||||
"player can not load max loadout" in {
|
||||
val avatar = Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute)
|
||||
val player = Player(avatar)
|
||||
avatar.SaveLoadout(player, "test1", 0)
|
||||
player.ExoSuit = ExoSuitType.MAX
|
||||
avatar.SaveLoadout(player, "test2", 1)
|
||||
|
||||
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.Loadout, 4, "", 1, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg2) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,92 +1,95 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects.terminal
|
||||
|
||||
import akka.actor.ActorRef
|
||||
import net.psforever.objects.serverobject.structures.{Building, StructureType}
|
||||
import net.psforever.objects.serverobject.terminals.Terminal
|
||||
import net.psforever.objects.zones.Zone
|
||||
import net.psforever.objects.{AmmoBox, Avatar, GlobalDefinitions, Player, Tool}
|
||||
import net.psforever.objects._
|
||||
import net.psforever.packet.game.{ItemTransactionMessage, PlanetSideGUID}
|
||||
import net.psforever.types._
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
class OrderTerminalTest extends Specification {
|
||||
"Order_Terminal" should {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
||||
val terminal = Terminal(GlobalDefinitions.order_terminal)
|
||||
terminal.Owner = new Building(0, Zone.Nowhere, StructureType.Building)
|
||||
terminal.Owner.Faction = PlanetSideEmpire.TR
|
||||
val avatar = Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute)
|
||||
val player = Player(avatar)
|
||||
|
||||
"construct" in {
|
||||
val terminal = Terminal(GlobalDefinitions.order_terminal)
|
||||
terminal.Actor mustEqual ActorRef.noSender
|
||||
val building = new Building(0, Zone.Nowhere, StructureType.Building)
|
||||
building.Faction = PlanetSideEmpire.TR
|
||||
val infantryTerminal = Terminal(GlobalDefinitions.order_terminal)
|
||||
infantryTerminal.Owner = building
|
||||
|
||||
"General terminal behavior" should {
|
||||
"player can not buy equipment from the wrong page ('9mmbullet_AP', page 10)" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 1, "9mmbullet_AP", 0, PlanetSideGUID(0))
|
||||
|
||||
infantryTerminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
|
||||
"Infantry Order Terminal" should {
|
||||
"player can buy a box of ammunition ('9mmbullet_AP')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "9mmbullet_AP", 0, PlanetSideGUID(0))
|
||||
val reply = terminal.Request(player, msg)
|
||||
val reply = infantryTerminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.BuyEquipment] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.BuyEquipment]
|
||||
reply2.item.isInstanceOf[AmmoBox] mustEqual true
|
||||
reply2.item.asInstanceOf[AmmoBox].Definition mustEqual GlobalDefinitions.bullet_9mm_AP
|
||||
reply2.item.asInstanceOf[AmmoBox].Capacity mustEqual 50
|
||||
}
|
||||
|
||||
"player can buy a weapon ('suppressor')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "suppressor", 0, PlanetSideGUID(0))
|
||||
val reply = terminal.Request(player, msg)
|
||||
val reply = infantryTerminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.BuyEquipment] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.BuyEquipment]
|
||||
reply2.item.isInstanceOf[Tool] mustEqual true
|
||||
reply2.item.asInstanceOf[Tool].Definition mustEqual GlobalDefinitions.suppressor
|
||||
}
|
||||
|
||||
"player can buy a box of vehicle ammunition ('105mmbullet')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 3, "105mmbullet", 0, PlanetSideGUID(0))
|
||||
val reply = terminal.Request(player, msg)
|
||||
"player can buy different armor ('lite_armor')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 1, "lite_armor", 0, PlanetSideGUID(0))
|
||||
|
||||
infantryTerminal.Request(player, msg) mustEqual Terminal.BuyExosuit(ExoSuitType.Agile)
|
||||
}
|
||||
|
||||
"player can buy a box of ammunition belonging to a special armor type ('dualcycler_ammo')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 1, "dualcycler_ammo", 0, PlanetSideGUID(0))
|
||||
val reply = infantryTerminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.BuyEquipment] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.BuyEquipment]
|
||||
reply2.item.isInstanceOf[AmmoBox] mustEqual true
|
||||
reply2.item.asInstanceOf[AmmoBox].Definition mustEqual GlobalDefinitions.bullet_105mm
|
||||
reply2.item.asInstanceOf[AmmoBox].Capacity mustEqual 100
|
||||
reply2.item.asInstanceOf[AmmoBox].Definition mustEqual GlobalDefinitions.dualcycler_ammo
|
||||
}
|
||||
|
||||
"player can buy a support tool ('bank')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 2, "bank", 0, PlanetSideGUID(0))
|
||||
val reply = terminal.Request(player, msg)
|
||||
val reply = infantryTerminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.BuyEquipment] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.BuyEquipment]
|
||||
reply2.item.isInstanceOf[Tool] mustEqual true
|
||||
reply2.item.asInstanceOf[Tool].Definition mustEqual GlobalDefinitions.bank
|
||||
}
|
||||
|
||||
"player can buy different armor ('lite_armor')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 1, "lite_armor", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.BuyExosuit(ExoSuitType.Agile)
|
||||
"player can buy a box of vehicle ammunition ('105mmbullet')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 3, "105mmbullet", 0, PlanetSideGUID(0))
|
||||
val reply = infantryTerminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.BuyEquipment] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.BuyEquipment]
|
||||
reply2.item.isInstanceOf[AmmoBox] mustEqual true
|
||||
reply2.item.asInstanceOf[AmmoBox].Definition mustEqual GlobalDefinitions.bullet_105mm
|
||||
}
|
||||
|
||||
"player can not buy fake equipment ('sabot')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "sabot", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
|
||||
"player can not buy equipment from the wrong page ('9mmbullet_AP', page 1)" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 1, "9mmbullet_AP", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
infantryTerminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
|
||||
"player can retrieve an infantry loadout" in {
|
||||
val avatar = Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute)
|
||||
val player2 = Player(avatar)
|
||||
player2.ExoSuit = ExoSuitType.Agile
|
||||
player2.Slot(0).Equipment = Tool(GlobalDefinitions.beamer)
|
||||
player2.Slot(6).Equipment = Tool(GlobalDefinitions.beamer)
|
||||
avatar.SaveLoadout(player2, "test", 0)
|
||||
player.ExoSuit = ExoSuitType.Agile
|
||||
player.Slot(0).Equipment = Tool(GlobalDefinitions.beamer)
|
||||
player.Slot(6).Equipment = Tool(GlobalDefinitions.beamer)
|
||||
avatar.SaveLoadout(player, "test", 0)
|
||||
|
||||
val msg = terminal.Request(player2, ItemTransactionMessage(PlanetSideGUID(10), TransactionType.Loadout, 4, "", 0, PlanetSideGUID(0)))
|
||||
val msg = infantryTerminal.Request(player, ItemTransactionMessage(PlanetSideGUID(10), TransactionType.Loadout, 4, "", 0, PlanetSideGUID(0)))
|
||||
msg.isInstanceOf[Terminal.InfantryLoadout] mustEqual true
|
||||
val loadout = msg.asInstanceOf[Terminal.InfantryLoadout]
|
||||
loadout.exosuit mustEqual ExoSuitType.Agile
|
||||
|
|
@ -98,28 +101,120 @@ class OrderTerminalTest extends Specification {
|
|||
loadout.inventory.head.start mustEqual 6
|
||||
}
|
||||
|
||||
"player can not retrieve an infantry loadout from the wrong page" in {
|
||||
val avatar = Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute)
|
||||
val player2 = Player(avatar)
|
||||
player2.ExoSuit = ExoSuitType.Agile
|
||||
player2.Slot(0).Equipment = Tool(GlobalDefinitions.beamer)
|
||||
player2.Slot(6).Equipment = Tool(GlobalDefinitions.beamer)
|
||||
avatar.SaveLoadout(player2, "test", 0)
|
||||
|
||||
val msg = terminal.Request(player2, ItemTransactionMessage(PlanetSideGUID(10), TransactionType.Loadout, 3, "", 0, PlanetSideGUID(0))) //page 3
|
||||
msg.isInstanceOf[Terminal.NoDeal] mustEqual true
|
||||
}
|
||||
|
||||
"player can not retrieve an infantry loadout from the wrong line" in {
|
||||
val avatar = Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute)
|
||||
val player2 = Player(avatar)
|
||||
player2.ExoSuit = ExoSuitType.Agile
|
||||
player2.Slot(0).Equipment = Tool(GlobalDefinitions.beamer)
|
||||
player2.Slot(6).Equipment = Tool(GlobalDefinitions.beamer)
|
||||
avatar.SaveLoadout(player2, "test", 0)
|
||||
|
||||
val msg = terminal.Request(player2, ItemTransactionMessage(PlanetSideGUID(10), TransactionType.Loadout, 4, "", 1, PlanetSideGUID(0)))
|
||||
val msg = infantryTerminal.Request(player, ItemTransactionMessage(PlanetSideGUID(10), TransactionType.Loadout, 4, "", 1, PlanetSideGUID(0)))
|
||||
msg.isInstanceOf[Terminal.NoDeal] mustEqual true
|
||||
}
|
||||
}
|
||||
|
||||
"Vehicle Terminal" should {
|
||||
val terminal = Terminal(GlobalDefinitions.ground_vehicle_terminal)
|
||||
terminal.Owner = building
|
||||
|
||||
"player can spawn a vehicle and its default trunk contents" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 46769, "quadassault", 0, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg) match {
|
||||
case Terminal.BuyVehicle(vehicle, weapons, trunk) =>
|
||||
vehicle.Definition mustEqual GlobalDefinitions.quadassault
|
||||
|
||||
weapons.size mustEqual 0 //note: vehicles never have custom weapons using the default loadout
|
||||
|
||||
trunk.size mustEqual 4
|
||||
trunk.head.obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
trunk(1).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
trunk(2).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
trunk(3).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"player can not spawn a fake vehicle ('harasser')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 46769, "harasser", 0, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
|
||||
"player can retrieve a vehicle loadout" in {
|
||||
val fury = Vehicle(GlobalDefinitions.fury)
|
||||
fury.Slot(30).Equipment = AmmoBox(GlobalDefinitions.hellfire_ammo)
|
||||
avatar.SaveLoadout(fury, "test", 10)
|
||||
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Loadout, 4, "test", 0, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg) match {
|
||||
case Terminal.VehicleLoadout(definition, weapons, trunk) =>
|
||||
definition mustEqual GlobalDefinitions.fury
|
||||
|
||||
weapons.size mustEqual 1
|
||||
weapons.head.obj.Definition mustEqual GlobalDefinitions.fury_weapon_systema
|
||||
|
||||
trunk.size mustEqual 1
|
||||
trunk.head.obj.Definition mustEqual GlobalDefinitions.hellfire_ammo
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
||||
ok
|
||||
}
|
||||
}
|
||||
|
||||
"Certification Terminal" should {
|
||||
val terminal = Terminal(GlobalDefinitions.cert_terminal)
|
||||
terminal.Owner = building
|
||||
|
||||
"player can learn a certification ('medium_assault')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Learn, 0, "medium_assault", 0, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg) mustEqual Terminal.LearnCertification(CertificationType.MediumAssault)
|
||||
}
|
||||
|
||||
"player can not learn a fake certification ('juggling')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Learn, 0, "juggling", 0, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
|
||||
"player can forget a certification ('medium_assault')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Sell, 0, "medium_assault", 0, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg) mustEqual Terminal.SellCertification(CertificationType.MediumAssault)
|
||||
}
|
||||
|
||||
"player can not forget a fake certification ('juggling')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Sell, 0, "juggling", 0, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
|
||||
"Implant_Terminal_Interface" should {
|
||||
val terminal = Terminal(GlobalDefinitions.implant_terminal_interface)
|
||||
terminal.Owner = building
|
||||
|
||||
"player can learn an implant ('darklight_vision')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "darklight_vision", 0, PlanetSideGUID(0))
|
||||
|
||||
val reply = terminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.LearnImplant] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.LearnImplant]
|
||||
reply2.implant mustEqual GlobalDefinitions.darklight_vision
|
||||
}
|
||||
|
||||
"player can not learn a fake implant ('aimbot')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "aimbot", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
|
||||
"player can un-learn an implant ('darklight_vision')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Sell, 0, "darklight_vision", 0, PlanetSideGUID(0))
|
||||
|
||||
val reply = terminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.SellImplant] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.SellImplant]
|
||||
reply2.implant mustEqual GlobalDefinitions.darklight_vision
|
||||
}
|
||||
|
||||
"player can not un-learn a fake implant ('aimbot')" in {
|
||||
val terminal = Terminal(GlobalDefinitions.implant_terminal_interface)
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Sell, 0, "aimbot", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class CertTerminalControl3Test extends ActorTest {
|
|||
class VehicleTerminalControl1Test extends ActorTest {
|
||||
"TerminalControl can be used to buy a vehicle ('two_man_assault_buggy')" in {
|
||||
val (player, terminal) = TerminalControlTest.SetUpAgents(GlobalDefinitions.ground_vehicle_terminal, PlanetSideEmpire.TR)
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "two_man_assault_buggy", 0, PlanetSideGUID(0))
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 46769, "two_man_assault_buggy", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Actor ! Terminal.Request(player, msg)
|
||||
val reply = receiveOne(Duration.create(500, "ms"))
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects.terminal
|
||||
|
||||
import akka.actor.ActorRef
|
||||
import net.psforever.objects.serverobject.structures.{Building, StructureType}
|
||||
import net.psforever.objects.{Avatar, GlobalDefinitions, Player}
|
||||
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, CharacterVoice, PlanetSideEmpire, TransactionType}
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
class VehicleTerminalCombinedTest extends Specification {
|
||||
"Ground_Vehicle_Terminal" should {
|
||||
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
||||
val terminal = Terminal(GlobalDefinitions.vehicle_terminal_combined)
|
||||
terminal.Owner = new Building(0, Zone.Nowhere, StructureType.Building)
|
||||
terminal.Owner.Faction = PlanetSideEmpire.TR
|
||||
|
||||
"construct" in {
|
||||
val terminal = Terminal(GlobalDefinitions.vehicle_terminal_combined)
|
||||
terminal.Actor mustEqual ActorRef.noSender
|
||||
}
|
||||
|
||||
"player can buy a ground vehicle, the harasser ('two_man_assault_buggy')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "two_man_assault_buggy", 0, PlanetSideGUID(0))
|
||||
|
||||
val reply = terminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.BuyVehicle] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.BuyVehicle]
|
||||
reply2.vehicle.Definition mustEqual GlobalDefinitions.two_man_assault_buggy
|
||||
reply2.weapons mustEqual Nil
|
||||
reply2.inventory.length mustEqual 6
|
||||
reply2.inventory.head.obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
reply2.inventory(1).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
reply2.inventory(2).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
reply2.inventory(3).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
reply2.inventory(4).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
reply2.inventory(5).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
||||
}
|
||||
|
||||
"player can buy a flying vehicle, the reaver ('lightgunship')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "lightgunship", 0, PlanetSideGUID(0))
|
||||
|
||||
val reply = terminal.Request(player, msg)
|
||||
reply.isInstanceOf[Terminal.BuyVehicle] mustEqual true
|
||||
val reply2 = reply.asInstanceOf[Terminal.BuyVehicle]
|
||||
reply2.vehicle.Definition mustEqual GlobalDefinitions.lightgunship
|
||||
reply2.weapons mustEqual Nil
|
||||
reply2.inventory.length mustEqual 6
|
||||
reply2.inventory.head.obj.Definition mustEqual GlobalDefinitions.reaver_rocket
|
||||
reply2.inventory(1).obj.Definition mustEqual GlobalDefinitions.reaver_rocket
|
||||
reply2.inventory(2).obj.Definition mustEqual GlobalDefinitions.reaver_rocket
|
||||
reply2.inventory(3).obj.Definition mustEqual GlobalDefinitions.reaver_rocket
|
||||
reply2.inventory(4).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
reply2.inventory(5).obj.Definition mustEqual GlobalDefinitions.bullet_20mm
|
||||
}
|
||||
|
||||
"player can not buy a fake vehicle ('harasser')" in {
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "harasser", 0, PlanetSideGUID(0))
|
||||
|
||||
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue