mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-24 17:13:34 +00:00
commit before changes, and to switch gears momentarily; making charId somewhat native to Avatar and its converter, though not yet essential; protype for squad definition loadouts, even though no example of functionality exists; a lot of unimplemented work in preparation to convert SquadDetailDefinitionUpdateMessage from a static format to a variable-field format
This commit is contained in:
parent
14bdcb7a7e
commit
fd9a3a0216
22 changed files with 938 additions and 131 deletions
|
|
@ -281,7 +281,7 @@ class AvatarTest extends Specification {
|
|||
|
||||
"does not have any loadout specifications by default" in {
|
||||
val (_, avatar) = CreatePlayer()
|
||||
(0 to 9).foreach { avatar.LoadLoadout(_) mustEqual None }
|
||||
(0 to 9).foreach { avatar.EquipmentLoadouts.LoadLoadout(_) mustEqual None }
|
||||
ok
|
||||
}
|
||||
|
||||
|
|
@ -289,9 +289,9 @@ class AvatarTest extends Specification {
|
|||
val (obj, avatar) = CreatePlayer()
|
||||
obj.Slot(0).Equipment.get.asInstanceOf[Tool].Magazine = 1 //non-standard but legal
|
||||
obj.Slot(2).Equipment.get.asInstanceOf[Tool].AmmoSlot.Magazine = 100 //non-standard (and out of range, real=25)
|
||||
avatar.SaveLoadout(obj, "test", 0)
|
||||
avatar.EquipmentLoadouts.SaveLoadout(obj, "test", 0)
|
||||
|
||||
avatar.LoadLoadout(0) match {
|
||||
avatar.EquipmentLoadouts.LoadLoadout(0) match {
|
||||
case Some(items : InfantryLoadout) =>
|
||||
items.label mustEqual "test"
|
||||
items.exosuit mustEqual obj.ExoSuit
|
||||
|
|
@ -329,25 +329,25 @@ class AvatarTest extends Specification {
|
|||
|
||||
"save player's current inventory as a loadout, only found in the called-out slot number" in {
|
||||
val (obj, avatar) = CreatePlayer()
|
||||
avatar.SaveLoadout(obj, "test", 0)
|
||||
avatar.EquipmentLoadouts.SaveLoadout(obj, "test", 0)
|
||||
|
||||
avatar.LoadLoadout(1).isDefined mustEqual false
|
||||
avatar.LoadLoadout(0).isDefined mustEqual true
|
||||
avatar.EquipmentLoadouts.LoadLoadout(1).isDefined mustEqual false
|
||||
avatar.EquipmentLoadouts.LoadLoadout(0).isDefined mustEqual true
|
||||
}
|
||||
|
||||
"try to save player's current inventory as a loadout, but will not save to an invalid slot" in {
|
||||
val (obj, avatar) = CreatePlayer()
|
||||
avatar.SaveLoadout(obj, "test", 10)
|
||||
avatar.EquipmentLoadouts.SaveLoadout(obj, "test", 10)
|
||||
|
||||
avatar.LoadLoadout(10) mustEqual None
|
||||
avatar.EquipmentLoadouts.LoadLoadout(10) mustEqual None
|
||||
}
|
||||
|
||||
"save player's current inventory as a loadout, without inventory contents" in {
|
||||
val (obj, avatar) = CreatePlayer()
|
||||
obj.Inventory.Clear()
|
||||
avatar.SaveLoadout(obj, "test", 0)
|
||||
avatar.EquipmentLoadouts.SaveLoadout(obj, "test", 0)
|
||||
|
||||
avatar.LoadLoadout(0) match {
|
||||
avatar.EquipmentLoadouts.LoadLoadout(0) match {
|
||||
case Some(items : InfantryLoadout) =>
|
||||
items.label mustEqual "test"
|
||||
items.exosuit mustEqual obj.ExoSuit
|
||||
|
|
@ -364,9 +364,9 @@ class AvatarTest extends Specification {
|
|||
obj.Slot(0).Equipment = None
|
||||
obj.Slot(2).Equipment = None
|
||||
obj.Slot(4).Equipment = None
|
||||
avatar.SaveLoadout(obj, "test", 0)
|
||||
avatar.EquipmentLoadouts.SaveLoadout(obj, "test", 0)
|
||||
|
||||
avatar.LoadLoadout(0) match {
|
||||
avatar.EquipmentLoadouts.LoadLoadout(0) match {
|
||||
case Some(items : InfantryLoadout) =>
|
||||
items.label mustEqual "test"
|
||||
items.exosuit mustEqual obj.ExoSuit
|
||||
|
|
@ -380,11 +380,11 @@ class AvatarTest extends Specification {
|
|||
|
||||
"save, load, delete; rapidly" in {
|
||||
val (obj, avatar) = CreatePlayer()
|
||||
avatar.SaveLoadout(obj, "test", 0)
|
||||
avatar.EquipmentLoadouts.SaveLoadout(obj, "test", 0)
|
||||
|
||||
avatar.LoadLoadout(0).isDefined mustEqual true
|
||||
avatar.DeleteLoadout(0)
|
||||
avatar.LoadLoadout(0) mustEqual None
|
||||
avatar.EquipmentLoadouts.LoadLoadout(0).isDefined mustEqual true
|
||||
avatar.EquipmentLoadouts.DeleteLoadout(0)
|
||||
avatar.EquipmentLoadouts.LoadLoadout(0) mustEqual None
|
||||
}
|
||||
|
||||
"the fifth slot is the locker wrapped in an EquipmentSlot" in {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class OrderTerminalTest extends Specification {
|
|||
player.ExoSuit = ExoSuitType.Agile
|
||||
player.Slot(0).Equipment = Tool(GlobalDefinitions.beamer)
|
||||
player.Slot(6).Equipment = Tool(GlobalDefinitions.beamer)
|
||||
avatar.SaveLoadout(player, "test", 0)
|
||||
avatar.EquipmentLoadouts.SaveLoadout(player, "test", 0)
|
||||
|
||||
val msg = infantryTerminal.Request(player, ItemTransactionMessage(PlanetSideGUID(10), TransactionType.Loadout, 4, "", 0, PlanetSideGUID(0)))
|
||||
msg.isInstanceOf[Terminal.InfantryLoadout] mustEqual true
|
||||
|
|
@ -137,7 +137,7 @@ class OrderTerminalTest extends Specification {
|
|||
"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)
|
||||
avatar.EquipmentLoadouts.SaveLoadout(fury, "test", 10)
|
||||
|
||||
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Loadout, 4, "test", 0, PlanetSideGUID(0))
|
||||
terminal.Request(player, msg) match {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue