mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-20 02:24:45 +00:00
split previous Loadout into separate InfantryLoadout and VehicleLoadout classes; moved new Loadout code into its own package and corrected import statements; corrected Terminal code and tests
This commit is contained in:
parent
7673c8941b
commit
9d7d1b0456
|
|
@ -3,6 +3,7 @@ package net.psforever.objects
|
|||
|
||||
import net.psforever.objects.definition.{AvatarDefinition, ImplantDefinition}
|
||||
import net.psforever.objects.equipment.EquipmentSize
|
||||
import net.psforever.objects.loadouts.Loadout
|
||||
import net.psforever.types.{CertificationType, CharacterGender, ImplantType, PlanetSideEmpire}
|
||||
|
||||
import scala.annotation.tailrec
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package net.psforever.objects
|
|||
import net.psforever.objects.definition.AvatarDefinition
|
||||
import net.psforever.objects.equipment.{Equipment, EquipmentSize}
|
||||
import net.psforever.objects.inventory.{Container, GridInventory, InventoryItem}
|
||||
import net.psforever.objects.loadouts.Loadout
|
||||
import net.psforever.objects.serverobject.affinity.FactionAffinity
|
||||
import net.psforever.packet.game.PlanetSideGUID
|
||||
import net.psforever.types._
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package net.psforever.objects.loadouts
|
||||
|
||||
import net.psforever.types.ExoSuitType
|
||||
|
||||
final case class InfantryLoadout(label : String,
|
||||
visible_slots : List[Loadout.SimplifiedEntry],
|
||||
inventory : List[Loadout.SimplifiedEntry],
|
||||
exosuit : ExoSuitType.Value,
|
||||
subtype : Int) extends Loadout(label, visible_slots, inventory) {
|
||||
/**
|
||||
* The exo-suit in which the avatar will be dressed.
|
||||
* Might be restricted and, thus, restrict the rest of the `Equipment` from being constructed and given.
|
||||
* @return the exo-suit
|
||||
*/
|
||||
def ExoSuit : ExoSuitType.Value = exosuit
|
||||
|
||||
/**
|
||||
* The mechanized assault exo-suit specialization number that indicates whether the MAX performs:
|
||||
* anti-infantry (1),
|
||||
* anti-vehicular (2),
|
||||
* or anti-air work (3).
|
||||
* The major distinction is the type of arm weapons that MAX is equipped.
|
||||
* When the blueprint doesn't call for a MAX, the number will be 0.
|
||||
* @return the specialization number
|
||||
*/
|
||||
def Subtype : Int = subtype
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package net.psforever.objects
|
||||
package net.psforever.objects.loadouts
|
||||
|
||||
import net.psforever.objects._
|
||||
import net.psforever.objects.definition._
|
||||
import net.psforever.objects.equipment.Equipment
|
||||
import net.psforever.objects.inventory.InventoryItem
|
||||
|
|
@ -34,38 +35,16 @@ import scala.annotation.tailrec
|
|||
* @param label the name by which this inventory will be known when displayed in a Favorites list
|
||||
* @param visible_slots simplified representation of the `Equipment` that can see "seen" on the target
|
||||
* @param inventory simplified representation of the `Equipment` in the target's inventory or trunk
|
||||
* @param exosuit na
|
||||
* @param subtype na
|
||||
*/
|
||||
final case class Loadout(private val label : String,
|
||||
private val visible_slots : List[Loadout.SimplifiedEntry],
|
||||
private val inventory : List[Loadout.SimplifiedEntry],
|
||||
private val exosuit : ExoSuitType.Value,
|
||||
private val subtype : Int) {
|
||||
abstract class Loadout(label : String,
|
||||
visible_slots : List[Loadout.SimplifiedEntry],
|
||||
inventory : List[Loadout.SimplifiedEntry]) {
|
||||
/**
|
||||
* The label by which this `Loadout` is called.
|
||||
* @return the label
|
||||
*/
|
||||
def Label : String = label
|
||||
|
||||
/**
|
||||
* The exo-suit in which the avatar will be dressed.
|
||||
* Might be restricted and, thus, restrict the rest of the `Equipment` from being constructed and given.
|
||||
* @return the exo-suit
|
||||
*/
|
||||
def ExoSuit : ExoSuitType.Value = exosuit
|
||||
|
||||
/**
|
||||
* The mechanized assault exo-suit specialization number that indicates whether the MAX performs:
|
||||
* anti-infantry (1),
|
||||
* anti-vehicular (2),
|
||||
* or anti-air work (3).
|
||||
* The major distinction is the type of arm weapons that MAX is equipped.
|
||||
* When the blueprint doesn't call for a MAX, the number will be 0.
|
||||
* @return the specialization number
|
||||
*/
|
||||
def Subtype : Int = subtype
|
||||
|
||||
/**
|
||||
* The `Equipment` in the `Player`'s holster slots when this `Loadout` is created.
|
||||
* @return a `List` of the holster item blueprints
|
||||
|
|
@ -80,12 +59,8 @@ final case class Loadout(private val label : String,
|
|||
}
|
||||
|
||||
object Loadout {
|
||||
def apply(label : String, visible : List[SimplifiedEntry], inventory : List[SimplifiedEntry]) : Loadout = {
|
||||
new Loadout(label, visible, inventory, ExoSuitType.Standard, 0)
|
||||
}
|
||||
|
||||
def Create(player : Player, label : String) : Loadout = {
|
||||
new Loadout(
|
||||
InfantryLoadout(
|
||||
label,
|
||||
packageSimplifications(player.Holsters()),
|
||||
packageSimplifications(player.Inventory.Items.values.toList),
|
||||
|
|
@ -95,10 +70,11 @@ object Loadout {
|
|||
}
|
||||
|
||||
def Create(vehicle : Vehicle, label : String) : Loadout = {
|
||||
Loadout(
|
||||
VehicleLoadout(
|
||||
label,
|
||||
packageSimplifications(vehicle.Weapons.map({ case ((index, weapon)) => InventoryItem(weapon.Equipment.get, index) }).toList),
|
||||
packageSimplifications(vehicle.Trunk.Items.values.toList)
|
||||
packageSimplifications(vehicle.Trunk.Items.values.toList),
|
||||
vehicle.Definition
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -153,8 +129,12 @@ object Loadout {
|
|||
final case class ShorthandKit(definition : KitDefinition) extends Simplification
|
||||
|
||||
def DetermineSubtype(player : Player) : Int = {
|
||||
if(player.ExoSuit == ExoSuitType.MAX) {
|
||||
player.Slot(0).Equipment match {
|
||||
DetermineSubtype(player.ExoSuit, player.Slot(0).Equipment)
|
||||
}
|
||||
|
||||
def DetermineSubtype(suit : ExoSuitType.Value, weapon : Option[Equipment]) : Int = {
|
||||
if(suit == ExoSuitType.MAX) {
|
||||
weapon match {
|
||||
case Some(item) =>
|
||||
item.Definition match {
|
||||
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.nchev_scattercannon | GlobalDefinitions.vshev_quasar =>
|
||||
|
|
@ -180,7 +160,7 @@ object Loadout {
|
|||
* @param equipment the holster slots
|
||||
* @return a `List` of simplified `Equipment`
|
||||
*/
|
||||
private def packageSimplifications(equipment : Array[EquipmentSlot]) : List[SimplifiedEntry] = {
|
||||
protected def packageSimplifications(equipment : Array[EquipmentSlot]) : List[SimplifiedEntry] = {
|
||||
recursiveHolsterSimplifications(equipment.iterator)
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +169,7 @@ object Loadout {
|
|||
* @param equipment the enumerated contents of the inventory
|
||||
* @return a `List` of simplified `Equipment`
|
||||
*/
|
||||
private def packageSimplifications(equipment : List[InventoryItem]) : List[SimplifiedEntry] = {
|
||||
protected def packageSimplifications(equipment : List[InventoryItem]) : List[SimplifiedEntry] = {
|
||||
equipment.map(entry => { SimplifiedEntry(buildSimplification(entry.obj), entry.start) })
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package net.psforever.objects.loadouts
|
||||
|
||||
import net.psforever.objects.definition._
|
||||
|
||||
final case class VehicleLoadout(label : String,
|
||||
visible_slots : List[Loadout.SimplifiedEntry],
|
||||
inventory : List[Loadout.SimplifiedEntry],
|
||||
vehicle_definition : VehicleDefinition) extends Loadout(label, visible_slots, inventory) {
|
||||
def Definition : VehicleDefinition = vehicle_definition
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ package net.psforever.objects.serverobject.terminals
|
|||
import net.psforever.objects._
|
||||
import net.psforever.objects.definition._
|
||||
import net.psforever.objects.equipment.Equipment
|
||||
import net.psforever.objects.loadouts.Loadout
|
||||
import net.psforever.packet.game.ItemTransactionMessage
|
||||
import net.psforever.types.ExoSuitType
|
||||
|
||||
|
|
@ -336,7 +337,7 @@ object EquipmentTerminalDefinition {
|
|||
* `TerminalDefinition.MakeKit`
|
||||
*/
|
||||
def BuildSimplifiedPattern(entry : Loadout.Simplification) : Equipment = {
|
||||
import net.psforever.objects.Loadout._
|
||||
import net.psforever.objects.loadouts.Loadout._
|
||||
entry match {
|
||||
case obj : ShorthandTool =>
|
||||
val ammo : List[AmmoBoxDefinition] = obj.ammo.map(fmode => { fmode.ammo.definition })
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package net.psforever.objects.serverobject.terminals
|
|||
|
||||
import akka.actor.ActorContext
|
||||
import net.psforever.objects.Player
|
||||
import net.psforever.objects.loadouts.InfantryLoadout
|
||||
import net.psforever.objects.inventory.InventoryItem
|
||||
import net.psforever.objects.serverobject.structures.Amenity
|
||||
import net.psforever.packet.game.ItemTransactionMessage
|
||||
|
|
@ -52,7 +53,7 @@ class OrderTerminalABDefinition(object_id : Int) extends EquipmentTerminalDefini
|
|||
override def Loadout(player : Player, msg : ItemTransactionMessage) : Terminal.Exchange = {
|
||||
if(msg.item_page == 4) { //Favorites tab
|
||||
player.LoadLoadout(msg.unk1) match {
|
||||
case Some(loadout) =>
|
||||
case Some(loadout : InfantryLoadout) =>
|
||||
if(loadout.ExoSuit != ExoSuitType.MAX) {
|
||||
val holsters = loadout.VisibleSlots.map(entry => { InventoryItem(BuildSimplifiedPattern(entry.item), entry.index) })
|
||||
val inventory = loadout.Inventory.map(entry => { InventoryItem(BuildSimplifiedPattern(entry.item), entry.index) })
|
||||
|
|
@ -61,7 +62,7 @@ class OrderTerminalABDefinition(object_id : Int) extends EquipmentTerminalDefini
|
|||
else {
|
||||
Terminal.NoDeal()
|
||||
}
|
||||
case None =>
|
||||
case Some(_) | None =>
|
||||
Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package net.psforever.objects.serverobject.terminals
|
||||
|
||||
import net.psforever.objects.Player
|
||||
import net.psforever.objects.loadouts.InfantryLoadout
|
||||
import net.psforever.objects.inventory.InventoryItem
|
||||
import net.psforever.packet.game.ItemTransactionMessage
|
||||
import net.psforever.objects.serverobject.terminals.EquipmentTerminalDefinition._
|
||||
|
|
@ -37,11 +38,11 @@ class OrderTerminalDefinition extends EquipmentTerminalDefinition(612) {
|
|||
override def Loadout(player : Player, msg : ItemTransactionMessage) : Terminal.Exchange = {
|
||||
if(msg.item_page == 4) { //Favorites tab
|
||||
player.LoadLoadout(msg.unk1) match {
|
||||
case Some(loadout) =>
|
||||
case Some(loadout : InfantryLoadout) =>
|
||||
val holsters = loadout.VisibleSlots.map(entry => { InventoryItem(BuildSimplifiedPattern(entry.item), entry.index) })
|
||||
val inventory = loadout.Inventory.map(entry => { InventoryItem(BuildSimplifiedPattern(entry.item), entry.index) })
|
||||
Terminal.InfantryLoadout(loadout.ExoSuit, loadout.Subtype, holsters, inventory)
|
||||
case None =>
|
||||
case Some(_) | None =>
|
||||
Terminal.NoDeal()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package net.psforever.objects.serverobject.terminals
|
|||
|
||||
import net.psforever.objects.definition.VehicleDefinition
|
||||
import net.psforever.objects.{Player, Vehicle}
|
||||
import net.psforever.objects.loadouts.VehicleLoadout
|
||||
import net.psforever.objects.inventory.InventoryItem
|
||||
import net.psforever.packet.game.ItemTransactionMessage
|
||||
|
||||
|
|
@ -83,7 +84,7 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
// "aphelion_flight" -> (()=>Unit)
|
||||
)
|
||||
|
||||
import net.psforever.objects.{Loadout => _Loadout} //distinguish from Terminal.Loadout message
|
||||
import net.psforever.objects.loadouts.{Loadout => _Loadout} //distinguish from Terminal.Loadout message
|
||||
import _Loadout._
|
||||
/**
|
||||
* A `Map` of the default contents of a `Vehicle` inventory, called the trunk.
|
||||
|
|
@ -101,29 +102,31 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
val ammo_flux = ShorthandAmmoBox(flux_cannon_thresher_battery, flux_cannon_thresher_battery.Capacity)
|
||||
val ammo_bomb = ShorthandAmmoBox(liberator_bomb, liberator_bomb.Capacity)
|
||||
Map(
|
||||
//"quadstealth" -> _Loadout("default_quadstealth", List(), List()),
|
||||
"quadassault" -> _Loadout("default_quadassault", List(),
|
||||
//"quadstealth" -> VehicleLoadout("default_quadstealth", List(), List(), quadstealth),
|
||||
"quadassault" -> VehicleLoadout("default_quadassault", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_12mm, 30),
|
||||
SimplifiedEntry(ammo_12mm, 34),
|
||||
SimplifiedEntry(ammo_12mm, 74),
|
||||
SimplifiedEntry(ammo_12mm, 78)
|
||||
)
|
||||
),
|
||||
quadassault
|
||||
),
|
||||
{
|
||||
val ammo = ShorthandAmmoBox(hellfire_ammo, hellfire_ammo.Capacity)
|
||||
"fury" -> _Loadout("default_fury", List(),
|
||||
"fury" -> VehicleLoadout("default_fury", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo, 30),
|
||||
SimplifiedEntry(ammo, 34),
|
||||
SimplifiedEntry(ammo, 74),
|
||||
SimplifiedEntry(ammo, 78)
|
||||
)
|
||||
),
|
||||
fury
|
||||
)
|
||||
},
|
||||
//"ant" -> _Loadout("default_ant", List(), List()),
|
||||
//"ams" -> _Loadout("default_ams", List(), List()),
|
||||
"two_man_assault_buggy" -> _Loadout("default_two_man_assault_buggy", List(),
|
||||
//"ant" -> VehicleLoadout("default_ant", List(), List(), ant),
|
||||
//"ams" -> VehicleLoadout("default_ams", List(), List(), ams),
|
||||
"two_man_assault_buggy" -> VehicleLoadout("default_two_man_assault_buggy", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_12mm, 30),
|
||||
SimplifiedEntry(ammo_12mm, 34),
|
||||
|
|
@ -131,11 +134,12 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_12mm, 90),
|
||||
SimplifiedEntry(ammo_12mm, 94),
|
||||
SimplifiedEntry(ammo_12mm, 98)
|
||||
)
|
||||
),
|
||||
two_man_assault_buggy
|
||||
),
|
||||
{
|
||||
val ammo = ShorthandAmmoBox(skyguard_flak_cannon_ammo, skyguard_flak_cannon_ammo.Capacity)
|
||||
"skyguard" -> _Loadout("default_skyguard", List(),
|
||||
"skyguard" -> VehicleLoadout("default_skyguard", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_12mm, 30),
|
||||
SimplifiedEntry(ammo_12mm, 34),
|
||||
|
|
@ -143,10 +147,11 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo, 90),
|
||||
SimplifiedEntry(ammo, 94),
|
||||
SimplifiedEntry(ammo, 98)
|
||||
)
|
||||
),
|
||||
skyguard
|
||||
)
|
||||
},
|
||||
"threemanheavybuggy" -> _Loadout("default_threemanheavybuggy", List(),
|
||||
"threemanheavybuggy" -> VehicleLoadout("default_threemanheavybuggy", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_12mm, 30),
|
||||
SimplifiedEntry(ammo_12mm, 34),
|
||||
|
|
@ -154,11 +159,12 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_mortar, 90),
|
||||
SimplifiedEntry(ammo_mortar, 94),
|
||||
SimplifiedEntry(ammo_mortar, 98)
|
||||
)
|
||||
),
|
||||
threemanheavybuggy
|
||||
),
|
||||
{
|
||||
val ammo = ShorthandAmmoBox(firebird_missile, firebird_missile.Capacity)
|
||||
"twomanheavybuggy" -> _Loadout("default_twomanheavybuggy", List(),
|
||||
"twomanheavybuggy" -> VehicleLoadout("default_twomanheavybuggy", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo, 30),
|
||||
SimplifiedEntry(ammo, 34),
|
||||
|
|
@ -166,10 +172,11 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo, 90),
|
||||
SimplifiedEntry(ammo, 94),
|
||||
SimplifiedEntry(ammo, 98)
|
||||
)
|
||||
),
|
||||
twomanheavybuggy
|
||||
)
|
||||
},
|
||||
"twomanhoverbuggy" -> _Loadout("default_twomanhoverbuggy", List(),
|
||||
"twomanhoverbuggy" -> VehicleLoadout("default_twomanhoverbuggy", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_flux, 30),
|
||||
SimplifiedEntry(ammo_flux, 34),
|
||||
|
|
@ -177,9 +184,10 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_flux, 90),
|
||||
SimplifiedEntry(ammo_flux, 94),
|
||||
SimplifiedEntry(ammo_flux, 98)
|
||||
)
|
||||
),
|
||||
twomanhoverbuggy
|
||||
),
|
||||
"mediumtransport" -> _Loadout("default_mediumtransport", List(),
|
||||
"mediumtransport" -> VehicleLoadout("default_mediumtransport", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_20mm, 30),
|
||||
SimplifiedEntry(ammo_20mm, 34),
|
||||
|
|
@ -190,9 +198,10 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_20mm, 150),
|
||||
SimplifiedEntry(ammo_20mm, 154),
|
||||
SimplifiedEntry(ammo_20mm, 158)
|
||||
)
|
||||
),
|
||||
mediumtransport
|
||||
),
|
||||
"battlewagon" -> _Loadout("default_battlewagon", List(),
|
||||
"battlewagon" -> VehicleLoadout("default_battlewagon", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_15mm, 30),
|
||||
SimplifiedEntry(ammo_15mm, 34),
|
||||
|
|
@ -203,11 +212,12 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_15mm, 150),
|
||||
SimplifiedEntry(ammo_15mm, 154),
|
||||
SimplifiedEntry(ammo_15mm, 158)
|
||||
)
|
||||
),
|
||||
battlewagon
|
||||
),
|
||||
{
|
||||
val ammo = ShorthandAmmoBox(gauss_cannon_ammo, gauss_cannon_ammo.Capacity)
|
||||
"thunderer" -> _Loadout("default_thunderer", List(),
|
||||
"thunderer" -> VehicleLoadout("default_thunderer", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo, 30),
|
||||
SimplifiedEntry(ammo, 34),
|
||||
|
|
@ -218,12 +228,13 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo, 150),
|
||||
SimplifiedEntry(ammo, 154),
|
||||
SimplifiedEntry(ammo, 158)
|
||||
)
|
||||
),
|
||||
thunderer
|
||||
)
|
||||
},
|
||||
{
|
||||
val ammo = ShorthandAmmoBox(fluxpod_ammo, fluxpod_ammo.Capacity)
|
||||
"aurora" -> _Loadout("default_aurora", List(),
|
||||
"aurora" -> VehicleLoadout("default_aurora", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo, 30),
|
||||
SimplifiedEntry(ammo, 34),
|
||||
|
|
@ -234,10 +245,11 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo, 150),
|
||||
SimplifiedEntry(ammo, 154),
|
||||
SimplifiedEntry(ammo, 158)
|
||||
)
|
||||
),
|
||||
aurora
|
||||
)
|
||||
},
|
||||
"apc_tr" -> _Loadout("default_apc_tr", List(),
|
||||
"apc_tr" -> VehicleLoadout("default_apc_tr", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_75mm, 30),
|
||||
SimplifiedEntry(ammo_75mm, 34),
|
||||
|
|
@ -259,9 +271,10 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_15mm, 278),
|
||||
SimplifiedEntry(ammo_15mm, 282),
|
||||
SimplifiedEntry(ammo_15mm, 286)
|
||||
)
|
||||
),
|
||||
apc_tr
|
||||
),
|
||||
"apc_nc" -> _Loadout("default_apc_nc", List(),
|
||||
"apc_nc" -> VehicleLoadout("default_apc_nc", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_75mm, 30),
|
||||
SimplifiedEntry(ammo_75mm, 34),
|
||||
|
|
@ -283,9 +296,10 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_20mm, 278),
|
||||
SimplifiedEntry(ammo_20mm, 282),
|
||||
SimplifiedEntry(ammo_20mm, 286)
|
||||
)
|
||||
),
|
||||
apc_nc
|
||||
),
|
||||
"apc_vs" -> _Loadout("default_apc_vs", List(),
|
||||
"apc_vs" -> VehicleLoadout("default_apc_vs", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_75mm, 30),
|
||||
SimplifiedEntry(ammo_75mm, 34),
|
||||
|
|
@ -307,9 +321,10 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_flux, 278),
|
||||
SimplifiedEntry(ammo_flux, 282),
|
||||
SimplifiedEntry(ammo_flux, 286)
|
||||
)
|
||||
),
|
||||
apc_vs
|
||||
),
|
||||
"lightning" -> _Loadout("default_lightning", List(),
|
||||
"lightning" -> VehicleLoadout("default_lightning", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_25mm, 30),
|
||||
SimplifiedEntry(ammo_25mm, 34),
|
||||
|
|
@ -317,11 +332,12 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_75mm, 90),
|
||||
SimplifiedEntry(ammo_75mm, 94),
|
||||
SimplifiedEntry(ammo_75mm, 98)
|
||||
)
|
||||
),
|
||||
lightning
|
||||
),
|
||||
{
|
||||
val ammo = ShorthandAmmoBox(bullet_105mm, bullet_105mm.Capacity)
|
||||
"prowler" -> _Loadout("default_prowler", List(),
|
||||
"prowler" -> VehicleLoadout("default_prowler", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_15mm, 30),
|
||||
SimplifiedEntry(ammo_15mm, 34),
|
||||
|
|
@ -329,12 +345,13 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo, 90),
|
||||
SimplifiedEntry(ammo, 94),
|
||||
SimplifiedEntry(ammo, 98)
|
||||
)
|
||||
),
|
||||
prowler
|
||||
)
|
||||
},
|
||||
{
|
||||
val ammo = ShorthandAmmoBox(bullet_150mm, bullet_150mm.Capacity)
|
||||
"vanguard" -> _Loadout("default_vanguard", List(),
|
||||
"vanguard" -> VehicleLoadout("default_vanguard", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_20mm, 30),
|
||||
SimplifiedEntry(ammo_20mm, 34),
|
||||
|
|
@ -342,13 +359,14 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo, 90),
|
||||
SimplifiedEntry(ammo, 94),
|
||||
SimplifiedEntry(ammo, 98)
|
||||
)
|
||||
),
|
||||
vanguard
|
||||
)
|
||||
},
|
||||
{
|
||||
val ammo1 = ShorthandAmmoBox(pulse_battery, pulse_battery.Capacity)
|
||||
val ammo2 = ShorthandAmmoBox(heavy_rail_beam_battery, heavy_rail_beam_battery.Capacity)
|
||||
"magrider" -> _Loadout("default_magrider", List(),
|
||||
"magrider" -> VehicleLoadout("default_magrider", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo1, 30),
|
||||
SimplifiedEntry(ammo1, 34),
|
||||
|
|
@ -356,23 +374,25 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo2, 90),
|
||||
SimplifiedEntry(ammo2, 94),
|
||||
SimplifiedEntry(ammo2, 98)
|
||||
)
|
||||
),
|
||||
magrider
|
||||
)
|
||||
},
|
||||
//"flail" -> _Loadout("default_flail", List(), List()),
|
||||
//"switchblade" -> _Loadout("default_switchblade", List(), List()),
|
||||
//"router" -> _Loadout("default_router", List(), List()),
|
||||
"mosquito" -> _Loadout("default_mosquito", List(),
|
||||
//"flail" -> VehicleLoadout("default_flail", List(), List(), flail),
|
||||
//"switchblade" -> VehicleLoadout("default_switchblade", List(), List(), switchblade),
|
||||
//"router" -> VehicleLoadout("default_router", List(), List(), router),
|
||||
"mosquito" -> VehicleLoadout("default_mosquito", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_12mm, 30),
|
||||
SimplifiedEntry(ammo_12mm, 34),
|
||||
SimplifiedEntry(ammo_12mm, 74),
|
||||
SimplifiedEntry(ammo_12mm, 78)
|
||||
)
|
||||
),
|
||||
mosquito
|
||||
),
|
||||
{
|
||||
val ammo = ShorthandAmmoBox(reaver_rocket, reaver_rocket.Capacity)
|
||||
"lightgunship" -> _Loadout("default_lightgunship", List(),
|
||||
"lightgunship" -> VehicleLoadout("default_lightgunship", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo, 30),
|
||||
SimplifiedEntry(ammo, 34),
|
||||
|
|
@ -380,22 +400,24 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo, 90),
|
||||
SimplifiedEntry(ammo_20mm, 94),
|
||||
SimplifiedEntry(ammo_20mm, 98)
|
||||
)
|
||||
),
|
||||
lightgunship
|
||||
)
|
||||
},
|
||||
{
|
||||
val ammo1 = ShorthandAmmoBox(wasp_rocket_ammo, wasp_rocket_ammo.Capacity)
|
||||
val ammo2 = ShorthandAmmoBox(wasp_gun_ammo, wasp_gun_ammo.Capacity)
|
||||
"wasp" -> _Loadout("default_wasp", List(),
|
||||
"wasp" -> VehicleLoadout("default_wasp", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo1, 30),
|
||||
SimplifiedEntry(ammo1, 34),
|
||||
SimplifiedEntry(ammo2, 74),
|
||||
SimplifiedEntry(ammo2, 78)
|
||||
)
|
||||
),
|
||||
wasp
|
||||
)
|
||||
},
|
||||
"liberator" -> _Loadout("default_liberator", List(),
|
||||
"liberator" -> VehicleLoadout("default_liberator", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_35mm, 30),
|
||||
SimplifiedEntry(ammo_35mm, 34),
|
||||
|
|
@ -406,9 +428,10 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_bomb, 150),
|
||||
SimplifiedEntry(ammo_bomb, 154),
|
||||
SimplifiedEntry(ammo_bomb, 158)
|
||||
)
|
||||
),
|
||||
liberator
|
||||
),
|
||||
"vulture" -> _Loadout("default_vulture", List(),
|
||||
"vulture" -> VehicleLoadout("default_vulture", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_35mm, 30),
|
||||
SimplifiedEntry(ammo_35mm, 34),
|
||||
|
|
@ -418,9 +441,10 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_bomb, 98),
|
||||
SimplifiedEntry(ammo_bomb, 102),
|
||||
SimplifiedEntry(ammo_bomb, 106)
|
||||
) //TODO confirm
|
||||
), //TODO confirm
|
||||
vulture
|
||||
),
|
||||
"dropship" -> _Loadout("default_dropship", List(),
|
||||
"dropship" -> VehicleLoadout("default_dropship", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_20mm, 30),
|
||||
SimplifiedEntry(ammo_20mm, 34),
|
||||
|
|
@ -434,9 +458,10 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_20mm, 162),
|
||||
SimplifiedEntry(ammo_20mm, 166),
|
||||
SimplifiedEntry(ammo_20mm, 170)
|
||||
)
|
||||
),
|
||||
dropship
|
||||
),
|
||||
"galaxy_gunship" -> _Loadout("galaxy_gunship", List(),
|
||||
"galaxy_gunship" -> VehicleLoadout("galaxy_gunship", List(),
|
||||
List(
|
||||
SimplifiedEntry(ammo_35mm, 30),
|
||||
SimplifiedEntry(ammo_35mm, 34),
|
||||
|
|
@ -450,10 +475,11 @@ abstract class VehicleTerminalDefinition(objId : Int) extends TerminalDefinition
|
|||
SimplifiedEntry(ammo_mortar, 178),
|
||||
SimplifiedEntry(ammo_mortar, 182),
|
||||
SimplifiedEntry(ammo_mortar, 186)
|
||||
)
|
||||
),
|
||||
galaxy_gunship
|
||||
)
|
||||
//"phantasm" -> _Loadout("default_phantasm", List(), List()),
|
||||
//"lodestar" -> _Loadout("default_lodestar", List(), List()),
|
||||
//"phantasm" -> VehicleLoadout("default_phantasm", List(), List(), phantasm),
|
||||
//"lodestar" -> VehicleLoadout("default_lodestar", List(), List(), lodestar),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package objects
|
|||
|
||||
import net.psforever.objects.GlobalDefinitions._
|
||||
import net.psforever.objects._
|
||||
import net.psforever.objects.loadouts._
|
||||
import net.psforever.objects.definition.ImplantDefinition
|
||||
import net.psforever.types.{CharacterGender, ImplantType, PlanetSideEmpire}
|
||||
import org.specs2.mutable._
|
||||
|
|
@ -291,7 +292,7 @@ class AvatarTest extends Specification {
|
|||
avatar.SaveLoadout(obj, "test", 0)
|
||||
|
||||
avatar.LoadLoadout(0) match {
|
||||
case Some(items) =>
|
||||
case Some(items : InfantryLoadout) =>
|
||||
items.Label mustEqual "test"
|
||||
items.ExoSuit mustEqual obj.ExoSuit
|
||||
items.Subtype mustEqual 0
|
||||
|
|
@ -321,7 +322,7 @@ class AvatarTest extends Specification {
|
|||
inventory(4).item.asInstanceOf[Loadout.ShorthandAmmoBox].definition mustEqual energy_cell
|
||||
inventory(5).index mustEqual 39
|
||||
inventory(5).item.asInstanceOf[Loadout.ShorthandSimpleItem].definition mustEqual remote_electronics_kit
|
||||
case None =>
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
|
@ -347,13 +348,13 @@ class AvatarTest extends Specification {
|
|||
avatar.SaveLoadout(obj, "test", 0)
|
||||
|
||||
avatar.LoadLoadout(0) match {
|
||||
case Some(items) =>
|
||||
case Some(items : InfantryLoadout) =>
|
||||
items.Label mustEqual "test"
|
||||
items.ExoSuit mustEqual obj.ExoSuit
|
||||
items.Subtype mustEqual 0
|
||||
items.VisibleSlots.length mustEqual 3
|
||||
items.Inventory.length mustEqual 0 //empty
|
||||
case None =>
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
|
@ -366,13 +367,13 @@ class AvatarTest extends Specification {
|
|||
avatar.SaveLoadout(obj, "test", 0)
|
||||
|
||||
avatar.LoadLoadout(0) match {
|
||||
case Some(items) =>
|
||||
case Some(items : InfantryLoadout) =>
|
||||
items.Label mustEqual "test"
|
||||
items.ExoSuit mustEqual obj.ExoSuit
|
||||
items.Subtype mustEqual 0
|
||||
items.VisibleSlots.length mustEqual 0 //empty
|
||||
items.Inventory.length mustEqual 6
|
||||
case None =>
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package objects
|
||||
|
||||
import net.psforever.objects._
|
||||
import net.psforever.objects.loadouts._
|
||||
import net.psforever.types.{CharacterGender, ExoSuitType, PlanetSideEmpire}
|
||||
import net.psforever.objects.GlobalDefinitions._
|
||||
import org.specs2.mutable._
|
||||
|
|
@ -36,7 +37,7 @@ class LoadoutTest extends Specification {
|
|||
|
||||
"create a loadout that contains a player's inventory" in {
|
||||
val player = CreatePlayer()
|
||||
val obj = Loadout.Create(player, "test")
|
||||
val obj = Loadout.Create(player, "test").asInstanceOf[InfantryLoadout]
|
||||
|
||||
obj.Label mustEqual "test"
|
||||
obj.ExoSuit mustEqual obj.ExoSuit
|
||||
|
|
@ -71,16 +72,16 @@ class LoadoutTest extends Specification {
|
|||
slot.Equipment = None //only an unequipped slot can have its Equipment Size changed (Rifle -> Max)
|
||||
Player.SuitSetup(player, ExoSuitType.MAX)
|
||||
|
||||
val ldout1 = Loadout.Create(player, "weaponless")
|
||||
val ldout1 = Loadout.Create(player, "weaponless").asInstanceOf[InfantryLoadout]
|
||||
slot.Equipment = None
|
||||
slot.Equipment = Tool(trhev_dualcycler)
|
||||
val ldout2 = Loadout.Create(player, "cycler")
|
||||
val ldout2 = Loadout.Create(player, "cycler").asInstanceOf[InfantryLoadout]
|
||||
slot.Equipment = None
|
||||
slot.Equipment = Tool(trhev_pounder)
|
||||
val ldout3 = Loadout.Create(player, "pounder")
|
||||
val ldout3 = Loadout.Create(player, "pounder").asInstanceOf[InfantryLoadout]
|
||||
slot.Equipment = None
|
||||
slot.Equipment = Tool(trhev_burster)
|
||||
val ldout4 = Loadout.Create(player, "burster")
|
||||
val ldout4 = Loadout.Create(player, "burster").asInstanceOf[InfantryLoadout]
|
||||
|
||||
ldout1.Subtype mustEqual 0
|
||||
ldout2.Subtype mustEqual 1
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import net.psforever.objects._
|
|||
import net.psforever.objects.definition.ToolDefinition
|
||||
import net.psforever.objects.definition.converter.CorpseConverter
|
||||
import net.psforever.objects.equipment._
|
||||
import net.psforever.objects.loadouts._
|
||||
import net.psforever.objects.guid.{GUIDTask, Task, TaskResolver}
|
||||
import net.psforever.objects.inventory.{Container, GridInventory, InventoryItem}
|
||||
import net.psforever.objects.serverobject.mount.Mountable
|
||||
|
|
@ -2360,6 +2361,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
|||
}
|
||||
|
||||
case msg @ FavoritesRequest(player_guid, unk, action, line, label) =>
|
||||
log.info(s"FavoritesRequest: $msg")
|
||||
if(player.GUID == player_guid) {
|
||||
val name = label.getOrElse("missing_loadout_name")
|
||||
action match {
|
||||
|
|
@ -2372,7 +2374,6 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
|||
sendResponse(FavoritesMessage(0, player_guid, line, ""))
|
||||
}
|
||||
}
|
||||
log.info("FavoritesRequest: " + msg)
|
||||
|
||||
case msg @ WeaponDelayFireMessage(seq_time, weapon_guid) =>
|
||||
log.info("WeaponDelayFire: " + msg)
|
||||
|
|
|
|||
Loading…
Reference in a new issue